Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mode indicator in terminals #96

Open
spiderbit opened this issue Apr 27, 2020 · 4 comments
Open

mode indicator in terminals #96

spiderbit opened this issue Apr 27, 2020 · 4 comments

Comments

@spiderbit
Copy link

spiderbit commented Apr 27, 2020

When I start emacsclient in from a terminal tty/ssh, the cursor doesn't change between a line and a block depending if I am in command-mode or insert-mode, that makes it very hard to see in which Mode you are you only see the I or C in the left bottom corner.

Can that be somehow fixed (some .Xresources line, or other terminal emulator) or could there be some other indicator be used like changing the color of the cursor as example?

(set-cursor-color) also doesn't change the color in the console, so that workaround would also not work.

@wi11dey
Copy link
Contributor

wi11dey commented Apr 30, 2020

Afaik emacs uses the tty's native cursor to display the cursor, so it would be difficult to implement this.
Some terminals may have an escape code they recognize to change the cursor shape or color, but we would probably need to collect a list of these and add it to Emacs itself, so setting cursor-type will do the right thing on ttys

@ghost
Copy link

ghost commented May 12, 2021

This is how I did it for 'xterm', just adapt to whatever
terminal emulator you use.

(defun my/xterm-cursor ()
  "Change the cursor shape in xterm to match the GUI (xah-fly-keys)."
  (unless (display-graphic-p)
    (if xah-fly-insert-state-q
        (send-string-to-terminal "\033[6 q") ; Vertical bar
      (send-string-to-terminal "\033[2 q")))) ; Box
(add-hook 'xah-fly-command-mode-activate-hook #'my/xterm-cursor)
(add-hook 'xah-fly-insert-mode-activate-hook #'my/xterm-cursor)

@spiderbit
Copy link
Author

Would that be hard to add that to xah-fly-keys or has any disadvantages?

@ghost
Copy link

ghost commented May 19, 2021

Terminal emulator's use different ones and IDK anyway to find what terminal you
are in from inside GNU Emacs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants