martanne / dvtm

dvtm brings the concept of tiling window management, popularized by X11-window managers like dwm to the console. As a console window manager it tries to make it easy to work with multiple console based programs.
MIT License
843 stars 108 forks source link

Support for cursor style changing #129

Open Ingvix opened 1 year ago

Ingvix commented 1 year ago

...using the widely supported XTerm CSI sequences and either using tmux established custom terminfo capabilities to translate them for the host terminal or falling back to just passing them on as is, if such capabilities are not set in the terminfo.

First I tried to implement this in a noninterfering manner but as there doesn't seem to be a widely supported way to query for the current cursor style from the terminal, it's better to set the default in the configuration. Were it not set and windows do not get their cursor style set on creation, cursor styles from windows that have set it on their own after creation would leak into windows not having their own cursor style set and that would be undesirable.

I felt that the configured default cursor could also be used as the default that's set if the parameter is missing from the escape sequence or if it's 1 which xterm documentation states as the default value, instead of just passing them as is, making the cursor a blinking block in most cases. If there are terminals that use a different default value along with possibly a different escape sequences, this also provides the flexibility to retain that default if desired.

Fixes #128

Any feedback is welcome.

Ingvix commented 1 year ago

Though I'm a bit unsure whether the default value should actually be 0 or 1. The docs shows (default) at the end of option 1, but could it be just showing that value 1 is the set default to which 0 would point to? My implemention assumes 1 always points to default cursor.