Last changed: 10th May 1999 Introduction: ------------ Greetings: This distribution contains an updated version of Bill Paul's software cursor patch for Linux version 1.0 and 2.0. This patch provides modifications for the Linux console driver that allow it to generate a non-blinking software cursor to replace the sometimes irritating blinking cursor generated by the PC's video hardware. The software cursor can be any one of eight colors (sixteen colors if you have a VGA display) and each virtual console's cursor color can be different, if desired. Support is provided for switching from software to hardware cursors on the fly, and as well as changing the hardware cursor from the usual flashing underline to a flashing block. New in noblink 2.0: ------------------ - Kernel patch updated so that it can be used with 2.0 series kernels. - Patches to kernel configuration scripts added so that the default cursor type and colour can be specified when configuring the kernel (the additional options will be found in the "Character devices" section). - Also added configuration option to enable the keyboard NumLock by default, which is also necessary for some laptops. - cursor(1) utility extended to not crash when given an unknown keyword, and to accept UK spelling for "colour". New in noblink 1.7: ------------------ - No new features/bug fixes, just an updated patch for Linux 1.3.39 and later. Note that my address has changed to svm@kozmix.ow.nl. The next version will feature a new version of cursor(1) that can read default from a config file. (I'll have to dig through my old mail archives first. :) New in noblink 1.6: ------------------ - No new features/bug fixes, just an updated patch for Linux 1.3.3 and later. New in noblink 1.5: ------------------ - No new features/bug fixes, just an updated patch for Linux 1.1.92 and later. New in noblink 1.4: ------------------ - All known bugs with VGA cards fixed; all thanks to Davor Jadrijevic . The patch is reported to work with hercules cards. Also thanks to Joe George and all others who gave useful input. New in noblink 1.3: ------------------ - This patch is now being maintained by Sander van Malssen - Updated for Linux version 1.1.54 (meaning it should patch right into 1.2 once it's released) Note: ---- Version 1.3 of this patch has only been tested with VGA. I would appreciate feedback from people with other types of monitors. New in noblink 1.0: ------------------ - Finally fixed code to properly reinstate the hardware 'blinking underline' cursor correctly for all SVGA modes. (Should work correctly for all cards and modes now.) (Thanks to Joakim Rosqvist ) - Changed escape codes for underline/block selection to avoid silly conflict with my Dorio (DEC) terminal. - Added support for resetting of cursor mode to bootup defaults using the reset_terminal() function. (Thanks to Davor Jadrijevic ) - Added support for 16 cursor colors. (Also thanks to Joakim) Features: -------- - With this patch, the standard hardware-generated 'blinking underline' cursor can be replaced with a software-generated non-blinking block cursor. This is meant to help people who: * Have laptops/portables with LCD screens that make it hard to find the cursor * Want to add an extra touch of color to their consoles * Can't stand blinking cursors - The software cursor color on a given VC can be changed on the fly using VT-200 style escape codes. - Each VC's cursor type is maintained separately: you can have half of them using the software generated cursor, half of them using the hardware cursor, or any combination in between. Each VC's software cursor color is also maintained seperately: you can have a blue cursor on VC #1, red on VC #2, green on VC #3, and so on. - The software cursor color on a given VC can be changed at any time using VT-200 style escape codes. To make things simple, I've included a small C program that can generate all the cursor control codes for you. - The hardware cursor can be switched from a blinking underline to blinking block at run time using escape codes. The hardware cursor state is also maintained for each VC: half of them can be set to use underlines, the other half blocks, or any combination in between. - The software cursor color remains unchanged even if the foreground or background screen colors change. The exception is if you make the background color the same as the cursor color: this would render the cursor 'invisible', so the cursor will shift to a complement color to avoid this condition. - Can be safely used with selection 1.7, dosemu, XFree86 and the setfont utility without problems. (At least, I haven't found any. :) - Offers the use of 16 background colors, and hence 16 cursor colors, if desired. System requirements: ------------------- - Linux 1.0 or 2.0 kernel sources - gcc 2.4.5 or higher (preferably higher) - Some manner of video hardware This is meant to work with any VGA/SVGA hardware in any resolution. It is known to work with monochrome Hercules adapters, though I have no idea what happens when you try to change cursor colors. It *should* also work with CGA displays, though this has not been tested. If you have a CGA adapter, try it and let me know how it works. Note: With VGA hardware, you normally only get 8 distinct background colors, plus 8 'flashing' versions of the same colors. It is possible to change this such that you get 16 distinct background colors instead. I've added yet another function to set_mode() that will toggle this behavior on and off, thus allowing people with VGA hardware to have 16 cursor colors. It is important to note that this changes the behavior of the 'setterm' command somewhat: setterm -blink doesn't produce blinking text anymore. Typing 'cursor 16color' will enable the 16 color mode and 'cursor 8color' will turn it off again. Like all the other cursor features, the color mode is maintained separately for each virtual console. Configuration: ------------- The default cursor configuration is set when configuring the kernel; the options will be found in the "Character devices" section. They should be self-explanatory. Legal values for the "Cursor colour" are: 0 16 32 48 64 80 96 112 black blue green cyan red magenta orange white If you have a VGA/SVGA card, you can add 8 extra colors to that list: 128 144 160 176 192 208 224 240 grey bright bright bright bright pink yellow bright blue green cyan red white Normally, the VGA hardware allows for 8 normal background colors plus 8 'flashing' versions of the same. However, this behavior can be changed such that you can have 16 normal background colors instead. A separate function and escape code are provided to set the behavior, which is only active when running on color VGA hardware. Note that setting the cursor color to black will actually work, only it will appear white on a black background since the code is smart enough to prevent the cursor from accidentally becoming 'invisible' due to a bad choice of screen colors. Where other colors are concerned, conflicts will be avoided by shifting either the cursor or the text beneath it to its complement color. The complement of black is obviously white. The complement of blue is yellow (which looks more orange that it does yellow, but it's called yellow in all the references I have so we'll stick with it), the complement of green is magenta, and so forth. The values set in the kernel configuration will become the defaults for all virtual consoles. If you elect to leave them unchanged, your kernel will boot with white non-blinking cursors on all of the VC's. You can use the cursor(1) program later to change them however you want. Escape codes: ------------ You can switch from software to hardware generated cursors on the fly using a VT-200 style escape code as follows: [?33h switch to hardware cursor [?33l switch to software cursor [?32h switch hardware cursor to block mode [?32l switch hardware cursor to underline mode [?31h switch to 16 background color mode [?31l switch to 8 background color mode Note that the two codes that control the hardware cursor characteristics may not appear to have any effect if you issue them while in software cursor mode. If you are already in hardware cursor mode, then you can use them to change the hardware cursor's characteristics and see the results immediately. Using them while in software cursor mode will work, but you won't notice the effect until you switch to the hardware cursor. Previously, I used the value [?34h and [?34l to switch the block/underline modes. I discovered recently that these codes are in fact used by some terminals (in particular the Dorio terminal which I won in a contest at UNIX Expo '93 and am now using on my Linux box :) to switch the direction on which characters are displayed on the screen. By that I mean that one code causes characters to be printed on the screen from right to left, while the other changes it back to left to right. No, really. It's true. You wouldn't believe the shock I got when I typed 'cursor block' at the terminal and everything started coming out backwards. Anyway, I changed the codes to avoid this conflict. For those of you who actually enjoy reading from right to left, sorry: you're out of luck. You can change the software cursor color using these additional codes: Standard colors Extended colors --------------- --------------- [100m black [228m grey [116m blue [244m bright blue [132m green [260m bright green [148m cyan [276m bright cyan [164m red [292m bright red [180m magenta [308m pink [196m orange [324m yellow [212m white [340m bright white Note that the number values in the color codes are the same as those listed previously, except that they are offset by 100. I did this to make these codes sufficiently bogus that they would not conflict with any existing codes that I don't know about. I don't think there are any applications that go anywhere near these values. To switch to 'extended color mode', you must use the command 'cursor 16color' or otherwise generate the code [?31h. You can then use the 'cursor' program to select one of the additional 8 colors from the 'extended' table. Note that these colors are only available if Linux detects your console as a color, 'EGA+' device. Trying to select one of the extended colors while in 8 color mode will have no effect. Installation: ------------ This distribution includes the following files: README cursor.c cursor.1 noblink-for-1.*.diff noblink-for-2.*.diff For kernel 1.0, the diff files are unified context diffs against the files: console.c console_struct.c vga.c and can be applied as follows: # cd .../linux/drivers/char # patch /dev/tty2 This will change VC #2's cursor to blue (you must have write permission to /dev/tty2 to do this, of course). The cursor will remain blue until another escape code is used to change it back. Schmoozing: ---------- As always, questions, comments, complaints, flames, suggestions, bug reports, bug fixes, or large sums of cash are welcomed and encouraged. Share and enjoy! Maintainer for 2.x: Jonathan Marten Internet : jjm@keelhaul.demon.co.uk Maintainer for 1.x: Sander van Malssen Internet : svm@kozmix.ow.nl Original author: Bill Paul Internet : ghod@drycas.club.cc.cmu.edu Bitnet : GHOD@DRYCAS