DEATH to CAPS-LOCK KEYS!!
This is a small collection of mechanisms I've come up with to remap caps-lock
on various machines/environments to "control". I'm kicking it out on the net
in the hope that others will find it useful and perhaps add to it. For
instance, I'd love to have an equivalent for windows. Send me your anti-
caps-lock hacks, and I'll happily maintain a collection of them.
Someone once said that the caps-lock key should be mounted somewhere on the
back of a computer, down under the rats nest of wires near the serial ports.
It wasn't me, but I wholeheartedly agree with them. I grew up on keyboards
that had "control" to the left of "A", where it should be, not in the
currently popular pinkie-wrenching lower left position. These help me
enjoy those better ergonomics of a bygone era. Try it, you might like it.
N.B.: there's nothing wrong with *my* wrists.
=== X windows ===
# This sometimes has permanent effects. Too *ing bad. Deal.
# It must go in this order, i.e. keysyms last, and separate invocations
# so the whole deal doesn't get skipped.
xmodmap -e 'clear Lock' -e 'clear Control'
xmodmap -e 'add Control = Control_L Caps_Lock'
xmodmap -e 'keysym Caps_Lock = Control_L'
xmodmap -e 'keysym BackSpace = Delete'
=== Linux console ===
# be root first
loadkeys << EOF
keycode 58 = Control
=== DOS ===
; This tiny tsr makes the "caps-lock" key act like the "Ctrl" key on
; the IBM 101-key keyboards.
; To get a real caps-lock, type shift+caps-lock.
; Warning: this one MUST be loaded before any other TSR's that replace
; the keyboard BIOS call!
;;; H* rehack: Completely disable caps lock, always mapping it to control.
;;; DOESN'T WORK if something else [windows, etc] comes along and later
;;; hooks int15 and/or int9 for itself. There's no good way around this,
;;; since whoever next grabs the ints gets called BEFORE us, and we're hosed.
;;; PC/TCP telnet is a notable offender in this regard.
old_int label dword
begin: jmp short init
; Int 15H points here. Int15 is called BY the stock BIOS int9 handler after
; INning the keyboard byte from 60H and setting ax=4Fh. Go figure.
bint: cmp AH,4FH ; is this "bios" keyboard interrupt?
jnz bint0 ; no, act normal.
cmp al, 03ah ; is it the "caps-lock" key
mov al, 01dh ; fake ctrl-down event
jmp short bint0
bint11: cmp al, 0bah ; caps-lock-up event?
mov al, 09dh ; fake ctrl-up event
bint0: jmp [old_int]
;--- end of TSR portion ---
init: xor AX,AX
mov AX,ES:[54H]; copy old int pointer
mov word ptr old_int,AX
mov word ptr old_int,AX
mov AX,offset bint
mov DX,offset init