Saturday, 29 October 2011

Stranger key on my keyboard!

Well, after ordering a new keyboard a while ago and having one of those strange double glazing keys on it, next time I ordered a keyboard I picked "linux" from the options.

I was expecting that maybe I would get a penguin or "super" or some such on the key in question.

Imagine my surprise when the keyboard arrived with the same strange key as before, but with caps lock and left control reversed, as well as escape and tilda reversed.

What is especially strange is the reversals are not just printing, but electrically as well. I thought (perhaps wrongly) that the key codes used on keyboards normally mapped their actual position not their function. That is why you have to tell the computer the keyboard layout you have. So swapping the actual key codes as well as the graphics was rather odd, IMHO.

ESC swapped with ~ I can just about cope with, but as the key tops swap nicely, I just needed a bit of xmodmap to swap them back...

xmodmap -e 'keycode 9=grave'
xmodmap -e 'keycode 49=Escape'

I agree CAPS LOCK is the most useless key ever, but I cannot see the point of moving it to the left CTRL key position, and I just cannot get used to that. So I want to swap back functionally even if the key tops will not interchange.

Well, using xmodmap as above is fine for these keys as well, except the CAPS LOCK and CONTROL aspects stay where it is! I eventually found that apart from renaming the keys I have to change attributes attached to the keys. First remove them :-
xmodmap -e 'remove Lock = Caps_Lock'
xmodmap -e 'remove Control = Control_L'

Then do the remapping...

xmodmap -e 'keycode 37=Caps_Lock'
xmodmap -e 'keycode 66=Control_L'

Then add the attributes back again...

xmodmap -e 'add Lock = Caps_Lock'
xmodmap -e 'add Control = Control_L'

But still - how do I get rid of this strange key that is not a penguin for some reason!


  1. You clearly use neither vi nor emacs as much as you should ;)

    Ctrl where Caps Lock is makes sense for emacs Ctrl-X Ctrl-C Ctrl-Shift-Meta-Hyper-% type combinations.

    Escape where ` would normally be makes sense for plain vi; it means you don't stretch as far to exit insert mode.

  2. Seems that's not all that got remapped. ;)
    The links in your tweets point to the RSS feed for the comments to a posting, not the posting itself.
    Is that really intended?

    Cheers from Finland

  3. The twitter thing I have no idea about - it is a blogger plug in that tweets and whenever I try and follow the link on twitter on my iPad it works perfectly linking to my blog...

  4. It seems to link to random chunks of XML when I follow those links.. I presume it's assuming that the browser you're using has a full RSS reader in, which none of the browsers I use have. Chrome and Android both just show unparsed XML, and Safari has an attempt at decoding it but ends up just listing headlines..

  5. The traditional 'glass terminals' DEC VT100 and Televideo 925 terminals, from which many unix workstation keyboard layouts were derived both had a normal keycap size for caps lock to the left of the A, and the Ctrl key to the left of that.

    Likewise the backtick / tilde key lived up past += but before a small backspace key.

    Cursor keys were in a row. That's one thing that IBM did right when they got to the AT enhanced keyboard layout was put then on dedicated keys in a layout that approximates the direction of movement. Of course, IBM stupidly kept the Num Lock key, which has baffled millions of people since.

  6. Surely you can just print a new penguin key?

  7. Not sure I can quite do well enough... :-)

  8. The best way to swap back to the windows-style caps lock layout would be to locate the dip switch to select this, which probably exists, and is probably reasonably accessible. Inspect the keyboard from all angles and look for plastic flaps.

    Also see the ctrl:nocaps and ctrl:swapcaps XkbOptions that can be set in xorg.conf. But of course with PCs, it's not just about X. The key mappings will then be wrong during BIOS, in the bootloader, and on the OS's text console. Good luck reconfiguring all those too!

    Note that even if you stick with the Unix-style layout, the physical key has a depressed area just where you'd always be pressing it. A normal Unix-style keyboard would have a full key butting up against the 'A', instead of that depression.

    In my experience, selecting the "Linux" option for a keyboard, and then receiving a control key in that position, would not be a surprise.

  9. Your "Alt" and "Glazing" keys also seem to be swapped compared to my keyboard.