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?
-
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.– EvgeniyFeb 2, 2019 at 15:57
2 Answers
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.
-
Okay, I am currently using xfce4-terminal. I have found
/usr/share/terminfo/x/xfce
file and decompiled it usinginfocmp xfce > xfce.ti
. Then I added civis sequence to is2. Recompiled it usingsudo 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 typedtput civis
, nothing changed. What am I doing wrong?– EvgeniyFeb 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
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
- "Cursor Movement and Panning". VT420 Programmer Reference Manual. EK-VT420-RM-002. February 1992. Digital.
- "Table 5–9 Terminal's Default Settings". VT510 Video Terminal Programmer Information. EK-VT510-RM. November 1993. DEC.