1
I am running Ubuntu 14.04 and using one of the virtual terminals (TTY[1-6], accessible via Ctrl-Alt-F[1-6]); I want to permanently change the appearance of my cursor from the apparent default, a blinking underline, to a blinking box. I can change it temporarily, but it is consistently resetting when certain applications are run.
Initially the cursor style in the TTY sessions was a blinking underline. I found that I could change it to a blinking box with the command:
printf '\e[?8c'
This changes the cursor in the terminal and is reflected in programs like emacs or elinks. So I placed the above command into my .bashrc.
However, certain applications seem to revert the cursor style to a blinking underline, and this persists even after exiting those applications. I can reset the cursor style to a blinking box by re-issuing the above command, sourcing .bashrc, or by logging out and back in.
For example, consider how the following 3 applications (tmux, emacs, elinks) affect the cursor style:
- tmux: the cursor style is immediately set to a blinking underline, this style is maintained in all applications run within tmux, and the change persists after exiting tmux. The above printf command has no effect in tmux.
- emacs: the cursor style is whichever style was active when I ran it, and then the style changes to a blinking underline upon exiting emacs.
- elinks: the cursor style is whichever style was active when I ran it, and the cursor style does NOT change upon exiting elinks.
I should note that I have emacs settings to set the cursor style (within emacs) to a box, and that while I have searched for a setting to set cursor style within tmux I could not find anything beyond an entry in tmux's man page, which states:
tmux understands some extensions to terminfo(5):
[...]
Cs, Csr
Change the cursor style. If set, a sequence such as this may be used to change the cursor to an underline:
$ printf '\033[4 q'
If Csr is set, it will be used to reset the cursor style instead of Cs.
Unfortunately I do not understand how to "set Cs" and, as mentioned above, I have tried issuing the printf command to set the cursor style inside tmux to no avail.
Another interesting note is that the issue with cursor style changing does not occur when running an X terminal emulator, such as XFCE4 Terminal. This only seems to occur in the TTYs.
I can't seem to find any information about other people that have had this problem or settings within the mentioned applications that might be causing the problem. What is causing this problem and how can I resolve it so that I consistently have a blinking block cursor style?
Thanks for your response. I tried modifying the terminfo entry using tic as you showed but it doesn't seem to have had any effect. Is there anything else that I can try? – llzrk – 2016-01-30T01:14:58.487
Thank you again. Your updated comment, in addition to the answers to this question lead me to the solution: tmux refers to the cnorm entry in infoterm to set the cursor style, so I issued the command "tput cnorm '\e[?8c'" to set the cnorm entry and "tput cvvis '\e[?8c'" to set the cvvis entry (for good measure). After logging back in and starting tmux, the fix appears to work!
– llzrk – 2016-01-30T14:28:56.257no problem: I started off thinking you were attempting to make
DECSCUSR
work, then realized the issue was emacs, etc. – Thomas Dickey – 2016-01-30T14:51:49.273