How do I disable the blinking cursor in gnome-terminal?

31,745

Solution 1

On Ubuntu Mate 20.04, the setting is at org.mate.interface cursor-blink. You can use dconf-editor to navigate there and set it to false, or

gsettings set org.mate.interface cursor-blink false

Solution 2

You can disable the blinking also from the command line (gconf-editor is not installed by default):

 gconftool-2 --set /apps/gnome-terminal/profiles/Default/cursor_blink_mode --type string off

For newer versions of gnome-terminal, the command has changed:

gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$(gsettings get org.gnome.Terminal.ProfilesList default|tr -d \')/ cursor-blink-mode off

Solution 3

I review this post on almost every single Gnome install. Seems that the actual variable name changes every so often.

My solution: gsettings list-recursively | grep blink

Then I set the link value from True to False. As of now, it is org.gnome.desktop.interface cursor-blink, so:

gsettings set org.gnome.desktop.interface cursor-blink false

Hope this helps someone else in the future!

Solution 4

You can send an escape sequence to the terminal (any POSIX compatible, I think) setting the current cursor character using tput:

tput civis    # invisible
tput cnorm    # normal       (usually an underscore)
tput cvvis    # very visible (usually a rectangle)

Just put whatever you prefer in your local runcom script: ~/.zshrc, ~/.bashrc - whatever's your poison - or in the global one in /etc if you wish for it to run for all users.

Solution 5

With python3

os.popen('tput civis').read()

I've discovered that the text printed is \x1b[?25l (with the l of light).
You can try :

$ printf '\x1b[?25l'

so you can with try the others commands if you want the string format (I work with python, I don't know how this is called else).
The aventage with '\x1b' or '\33' is that we can use it with another device (per example a micropython) to regular the terminal with the STDOUT.

Share:
31,745

Related videos on Youtube

Nemo
Author by

Nemo

Updated on September 18, 2022

Comments

  • Nemo
    Nemo over 1 year

    I could have sworn that there was once a setting for this in the gnome-terminal "Profile".

    And then in some version of Ubuntu, that setting disappeared, and I had to use System ➜ Preferences ➜ Keyboard to uncheck "Cursor blinks in text fields".

    Well, neither of those seems to be working now. So how do I make the cursor stop blinking?

  • Nemo
    Nemo almost 13 years
    As I mentioned in my question, I thought I disabled it globally under the Keyboard settings... But it did not have any effect on gnome-terminal. Which makes me wonder what "system" setting cursor_blink_mode is referring to. Anyway, my problem is fixed. Thanks again.
  • Maxy-B
    Maxy-B over 10 years
    @Nemo "system" probably refers to the value of the cursor-blink "gsetting", which you can query like so: gsettings get org.gnome.desktop.interface cursor-blink. There are other cursor-related gsettings that you could tweak as well, like cursor-blink-timeout, cursor-size, etc.
  • Gauthier
    Gauthier over 9 years
    I am trying to find the possible alternatives to "off" and "system". I still want a blinking cursor in the active terminal, only not in all the other ones.
  • mmoya
    mmoya over 7 years
    In Ubuntu 16.04 the gsettings set ... didn't worked for me. I solved it with gsettings set org.gnome.desktop.interface cursor-blink false.
  • mdd
    mdd over 7 years
    @mmoya: Hmm, it worked for me. Did you maybe rename your terminal profile from the default name (called "default")? The disadvantage of your solution is that it disables blinking for all applications, not just gnome-terminal.
  • mmoya
    mmoya over 7 years
    I actually named it as Default, when I opened the profile settings in the UI, it had no name. Anyway it shouldn't matter as the profile uuid is get from the gsettings get ... command, should it?
  • mdd
    mdd over 7 years
    the gsettings get command gets the uuid of a profile named default (which is the default name), does it work if you change the command to Default?
  • mmoya
    mmoya over 7 years
    I think I used default as name because the gsettings get ... works. It'd be nice to add a note to the answer saying that the command assumes the profile is called default.
  • Luc
    Luc over 6 years
    Thanks for providing a means of finding it rather than just the solution!
  • xaxxon
    xaxxon over 6 years
    This solution worked for me in ubuntu 17.10
  • xaxxon
    xaxxon almost 4 years
    MAKE SURE CAPS LOCK IS OFF BEFORE RUNNING THIS BECAUSE YOU CANT TURN IT OFF BECAUSE YOU HAVE NO CAPSLOCK KEY!!! Edit: It appears that setxkbmap -layout us -option maps capslock key back to capslock so you can turn capslock off and then run the original command again.
  • Kaki In
    Kaki In over 3 years
    l of light is here just to differentiate beetween 1 (one) and l (L).
  • Kaki In
    Kaki In over 3 years
    You can see the others advantages about \33 (escape) character on en.wikipedia.org/wiki/ANSI_escape_code
  • jazcap53
    jazcap53 over 2 years
    THANK you THANK you THANK you :-)