Present Perfect


Picture Gallery
Present Perfect

keyboard shortcuts

Filed under: Hacking — Thomas @ 14:39


At FOSDEM I was hacking a little on a script called Quicktile which seems to be a handy tool for window placement. More on that later, but one of the things that makes it useful is that you can have it listen to certain key combos and react on them for window placement.

Except that, both on my T61 Lenovo laptop and my Logitech Wave keyboard, the shortcuts you're supposed to use (Ctrl-Alt-Keypad numbers) don't actually work.

Since I've always been scared about the way keyboards are handled in Linux I never took the time to learn and am now thoroughly confused by all the layers involved. Raw, cooked, kernel, console, X, xcb, keyboard mappings, ...

So, simple question to all you knowledgeable hackers - if my Gnome Keyboard Shortcuts preferences applet behaves like this, in combination with ctrl-alt:

  • 1-2-3-4-6-7-8-9 are dead
  • 5 and 0 act like Escape (abort)
  • Enter is correctly recognized as KP Enter
  • All others (., /, *, -, +) are dead too

- then what is wrong, what should I reconfigure, or what should I do to get all my keypad keys recognized ?

Interestingly, my Thinkpad behaves much the same, except that it lacks a Keypad Enter, but the main Enter button is recognized as a KP Enter.

UPDATE: Jan pointed me in the right direction apparently this is due to the mousekeys function, which hijacks your numeric keypad to let you move the mouse pointer using the keyboard.

I had no idea this existed, and I honestly still don't know if I should be feeling mentally violated for having my interpretation of NumLock thus subverted, or whether I just discovered a supercool feature that would have helped me out in so many cases in the past where the mouse for some reason didn't work. Ah, the agony of having choice!

I'll try it out on my Thinkpad tomorrow.


  1. Hi,
    a few quick questions:
    -Do You have a keyboard defined in xorg.conf?
    -What is the keyboard layout in GNOME preferences?
    -What is your keyboard language?
    -Do you have multiple, conflicting (qwerty/azerty/dvorak) latin keyboard layouts defined in GNOME? See bug: http://bugzilla.gnome.org/show_bug.cgi?id=162726

    Comment by Eemil — 2009-02-23 @ 15:09

  2. It’s better to use the term ‘the keys are unassigned’ instead of saying they are ‘dead’. ‘Dead’ would refer to ‘dead keys’ which already have a special meaning to keyboard layouts.

    Comment by Simos — 2009-02-23 @ 16:01

  3. What about hacking on WinWrangler instead? :)

    Comment by Wouter — 2009-02-23 @ 16:45

  4. @Eemil:
    – Xorg.conf: it seems so, this one:
    # keyboard added by rhpxl
    Identifier “Keyboard0”
    Driver “kbd”
    Option “XkbModel” “pc105”
    Option “XkbLayout” “us”

    – in GNOME preferences, I have Logitech Ultra-X Cordless Media Desktop Keyboard (my WAVE is not in there, this one seems closest)
    – my language is USA International (with dead keys)
    – I have USA and USA International defined; I actually ran into that bug before. Not sure it applies in this case.

    Let me know what you draw from this!

    Comment by Thomas — 2009-02-23 @ 22:40

  5. This looks like the mousekeys function which you can setup in the accessibility settings in gnome. 5 is the primary mouse button, + is the secondary mouse button. The numbers point your mouse into a direction, but when pressing them only once you won’t notice much movement (just one pixel, which is hard to notice on high-resolution screens).

    Comment by Jan de Groot — 2009-02-23 @ 23:17

  6. There’s a bug where mouse keys turns itself on without the user doing anything, perhaps you’re hitting that?

    Comment by James — 2009-02-24 @ 05:59

  7. I would have recommended removing the keyboard from xorg.conf,
    if you’re running a recent enough system that has hal-based device detection in X.
    However, the mousekeys situation seems more likely to me now.

    Comment by Eemil — 2009-02-24 @ 06:27

  8. I was also failing to set “special characters” key combinations,
    The way i am setting the key bindings is through gconftool (is that a good idea?) – using rather than . So for each command i have something like :

    gconftool-2 -t string -s /apps/metacity/global_keybindings/run_command_1 “l”
    gconftool-2 -t string -s /apps/metacity/keybinding_commands/command_1 “quicktile.py middle”

    But this : gconftool-2 -t string -s /apps/metacity/global_keybindings/run_command_7 “.” would not work.
    Solution : gconftool-2 -t string -s /apps/metacity/global_keybindings/run_command_7 “period”

    I have a few set up so far :
    , -> comma
    – -> minus

    But i could not find the whole list…

    Comment by Kevin — 2009-02-24 @ 11:56

  9. This reminds me a bit of http://bbs.archlinux.org/viewtopic.php?id=64100&p=1
    Also, why implement listening to keyboard shortcuts? what’s wrong with xbindkeys?

    Comment by Dieter_be — 2009-03-03 @ 13:45

RSS feed for comments on this post. TrackBack URL

Leave a comment