0

I am curious, is there a way to hide the cursor right before it will be placed at the top left corner of the terminal emulator? And do it independently of terminal emulator (not modifying the source code). Is it possible to use terminfo for such purpose? Or is there something similar to .xinitrc or .bashrc, but for terminals?

2
  • What cursor are you talking about? The text cursor in the terminal, or the mouse cursor? Also, what do you mean with "without shell"?
    – Kusalananda
    Feb 2, 2019 at 15:48
  • Text cursor. I could do it by typing "tput civis" in the shell. The goal is to hide the cursor before it is placed on the terminal.
    – Evgeniy
    Feb 2, 2019 at 15:57

2 Answers 2

4

In terminfo, that's the civis capability:

      cursor_invisible            civis     vi     make cursor invisi-
                                                   ble

e.g.,

tput civis

but while that could be applied immediately on running the terminal, there's an instant where the terminal does the Right Thing™ and shows its cursor.

2
  • Okay, I am currently using xfce4-terminal. I have found /usr/share/terminfo/x/xfce file and decompiled it using infocmp xfce > xfce.ti. Then I added civis sequence to is2. Recompiled it using sudo tic xfce.ti, and nothing changed. The file has been changed, I checked the size and the timestamp. I thought that I missed something and changed civis sequence to clear sequence. Opened the terminal and typed tput civis, nothing changed. What am I doing wrong?
    – Evgeniy
    Feb 2, 2019 at 18:24
  • The initialization sequences are run by applications (such as vi) in the terminal. The terminal won't do that by itself. (And adding it to .bashrc is probably a bad idea...). Feb 2, 2019 at 19:01
2

No, there is not.

Terminal emulators do the same thing as real terminals: from the reset state the cursor starts off visible, until a control sequence is received from the host saying otherwise. The doco of (some of) the terminals being emulated explicitly defines the reset state, including the initial cursor visibility state.

Further reading

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .