left ctrl and
caps lock by creating ~/.Xmodmap
keycode 66 = Control_L keycode 37 = Caps_Lock clear Lock clear Control add Lock = Caps_Lock add Control = Control_L Control_R
$ xmodmap ~/.Xmodmap. Pressing the
left ctrl key works as expected, toggling caps lock. Pressing the
caps lock key works in general for simple shortcuts, such as
However, when multiple modifier keys are required (e.g.
alt+ctrl+i), this only works if I press the
alt key first. If I press the
caps lock key first, there is no effect.
I can reset the keyboard layout with
$ setxkbmap -layout us, and the above shortcut will work fine. If I run
$ xmodmap ~/.Xmodmap again, I have the same problem.
I also find that even for single-modifier combinations, I have to hold down the
caps lock key for a split-second longer than I used to with the vanilla
ctrl key for it to register. It's probably of the order of 0.01 seconds, but it's noticeable enough that incorrect signals are being sent one in ten times.
Also, if I swap
caps lock using
$ setxkbmap -layout us -option 'ctrl:swapcaps', I no longer notice the problem with the multiple modifiers. However, I still want to work out the problem with the xmodmap solution, as I'm getting a new keyboard soon, and will need to swap ctrl with a different key.
I've tried another keyboard (Das Keyboard) and it seems that the second problem of having to hold down
caps lock for a split second longer than I did with
ctrl is probably a hardware issue with the original keyboard (an Aluminium Apple wired keyboard). However, the first problem with multiple modifiers is still present.
I've tested different keystrokes in xev. Holding
alt then pressing the
caps lock key results in
keycode 66 (keysym 0x0, NoSymbol), as opposed to
keycode 66 (keysym 0xffe3, Control_L) when
alt is not held.