^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) Software cursor for VGA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) =======================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) by Pavel Machek <pavel@atrey.karlin.mff.cuni.cz>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) and Martin Mares <mj@atrey.karlin.mff.cuni.cz>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) Linux now has some ability to manipulate cursor appearance. Normally,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) you can set the size of hardware cursor. You can now play a few new
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) tricks: you can make your cursor look like a non-blinking red block,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) make it inverse background of the character it's over or to highlight
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) that character and still choose whether the original hardware cursor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) should remain visible or not. There may be other things I have never
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) thought of.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) The cursor appearance is controlled by a ``<ESC>[?1;2;3c`` escape sequence
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) where 1, 2 and 3 are parameters described below. If you omit any of them,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) they will default to zeroes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) first Parameter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) specifies cursor size::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 0=default
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 1=invisible
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 2=underline,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 8=full block
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) + 16 if you want the software cursor to be applied
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) + 32 if you want to always change the background color
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) + 64 if you dislike having the background the same as the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) foreground.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) Highlights are ignored for the last two flags.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) second parameter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) selects character attribute bits you want to change
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) (by simply XORing them with the value of this parameter). On standard
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) VGA, the high four bits specify background and the low four the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) foreground. In both groups, low three bits set color (as in normal
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) color codes used by the console) and the most significant one turns
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) on highlight (or sometimes blinking -- it depends on the configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) of your VGA).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) third parameter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) consists of character attribute bits you want to set.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) Bit setting takes place before bit toggling, so you can simply clear a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) bit by including it in both the set mask and the toggle mask.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) Examples
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) --------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) To get normal blinking underline, use::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) echo -e '\033[?2c'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) To get blinking block, use::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) echo -e '\033[?6c'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) To get red non-blinking block, use::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) echo -e '\033[?17;0;64c'