I'd like to map

  • Super + UpArrow to PageUp

  • Super + DownArrow to PageDown

  • Super + Left to Home

  • Super + Right to End

on an Apple aluminum wireless keyboard. Those who know the keyboard would note that it already does these with the Fn key by default; that's fine, and I'd like to keep that, but be able to do the same with a one-handed key combination as well, hence my wanting the Super mappings.

I've been searching around for a possible way to do this via xmodmap for 3 hours, yet nothing has worked.


try editing your /usr/share/X11/xkb/symbols/pc keyboard definition

(this will change your bindings globally, if you want something more fine tuned, there is some more work to do, like creating a custom keymap or a custom variant)

as you can see here:

key  {        [  Prior                ]       };
key  {        [  Next                 ]       };

as you can see the key PGUP is bound to "Prior". While:

 key  {        [  Left                 ]       };
 key  {        [  Down                 ]       };

LEFT and DOWN keys are bound to "Left" and "Down".

The part between brackets [ ] is a list of symbols to be generated. You can put more than one. The first one is the symbol associated with the unmodified key, while other positions are for symbols associated with the key + some modifier.

Commonly it's used to define the behavior of the key plus the "SHIFT" modifier:

  key  {        [         l,    L               ]       };
  key  {        [ semicolon,    colon           ]       };

But also other modifiers can be specified, for example in the esperanto map (epo):

  key   { [ jcircumflex,  Jcircumflex,  bracketleft,   braceleft  ] };
  key   { [ hcircumflex,  Hcircumflex,  bracketright,  braceright ] };

you can type a [ character by typing AltGr + key (the [ key on the us keymap), and { by Shift+AltGr + key .

So far so good. The sequence we can understand from looking at some simple examples is:

plain shift altgr shift+altgr

However, we want to be able to bind our LEFT and RIGHT key to the plain and CTRL+ALT modifiers. How to achieve that?

I have no idea, and never tried, but I'd take inspiration from /usr/share/X11/xkb/symbols/pc:

xkb_symbols "function" {
    key  {
        symbols[Group1]= [ F1,  XF86_Switch_VT_1 ]

Perhaps we can do the same thing for our arrow keys. Let's try to add the following lines:

 key  { type="CTRL+ALT", symbols[Group1]= [  Left, Prior                ]       };
 key  { type="CTRL+ALT", symbols[Group1]= [  Down, Next                 ]       };

Just below the original definitions of LEFT and DOWN, in the bottom part of the 'pc' file.

And then restart the X server. Sorry, but I cannot close my session right now to test it.

BTW, you might be interested in http://code.google.com/p/partiwm/wiki/xpra, so that you can restart the X session and still preserve some applications across restarts.

  • Unfortunately, this doesn't work either. I changed your "CTRL+ALT" to SUPER_R, SUPER, META, since I want to map the right Super key, not CTRL+ALT (which also doesn't work). I also tried adding identifiers after the "key" part (like <PGUP>) which I thought were missing, but no difference.
    – guest442
    Sep 6 '10 at 2:11

I've tried something similar using xmodmap and its cognates and didn't succeed. Try xbindkeys in conjunction with xdotool. This is what I put in ~/.xbindkeysrc to bind numeric keypad 1 and 2 to Ctrl-PageUp and Ctrl-PageDown:

"xdotool key ctrl+Prior" 
  Release + KP_End

"xdotool key ctrl+Next" 
  Release + KP_Down
  • Thanks; I've tried the same, but it doesn't seem to be working. Super + Down seems to emit the "~" character every few presses in the terminal (the normal PageDown does this too, so it led me to think it worked), but it doesn't actually perform PageDown.
    – guest442
    Sep 5 '10 at 14:59
  • I've also tried xautomation and xvkbd; they both fail the same way. I'm sure the xbindkeys part is working, since I can get the key combinations to launch other apps and so on with it, but the keypresses just don't get emulated.
    – guest442
    Sep 5 '10 at 20:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.