How can I map Super + UpArrow to PageUp?

Solution 1:

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  {
        type="CTRL+ALT",
        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.

Solution 2:

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