How do I map key "Super" so, when combined with Left/Right, it produces keycode Home/End?

My current setxkbmap:

setxkbmap \
  -model pc105 \
  -layout 'us(dvorak-intl),us(alt-intl)' \
  -option \
  -option grp:lctrl_lshift_toggle \
  -option compose:rwin
  • 1
    Just FYI, Gedit honors the gtktextview shortcuts: Ctrl+Shift+PageUp and Ctrl+Shift+PageDown to select (or continue to select) all the way to the beginning and respectively the end of the line. I don't think that's what you're after, though... :) Feb 20, 2013 at 12:25
  • I have updated this question so more specific to root of what I want...not just for gedit but as broadly as possible within X.
    – iokevins
    Feb 24, 2013 at 3:33
  • Possible other answer: superuser.com/questions/469004/remap-superarrow-key-to-home-end
    – iokevins
    Feb 24, 2013 at 3:59

1 Answer 1


You can't do it with just a setkxbmap option, as no default option does what you want.

But you can do it by defining key behaviour at a lower level.

The page http://madduck.net/docs/extending-xkb/ helped me to understand and find a way to do it.

Create a file ~/.xkb/keymap/mykbd where you put the output of setxkbmap, it will be your base keyboard definition; eg:

setxkbmap -print > ~/.xkb/keymap/mykbd

then we will create a ~/.xkb/types/mytypes file and put the following in:

xkb_types "super_level2" {
    Virtual_modifiers Super;
    type "SUPER_LEVEL2" {
        modifiers= Super;
        map[Super]= Level2;
        level_name[Level1]= "Base";
        level_name[Level2]= "Super";

it defines a type SUPER_LEVEL2 that will allow to easily define symbols sent when a key is pressed with Super.

then, in the ~/.xkb/symbols/mysymbols put the following lines:

partial modifier_keys
xkb_symbols "super_arrows_home_end" {
    key <LEFT>  {
        type[Group1] = "SUPER_LEVEL2",
        symbols[Group1] = [    Left,   Home      ]
    key <RGHT>  {
        type[Group1] = "SUPER_LEVEL2",
        symbols[Group1] = [    Right,  End       ]

(note the use of the "SUPER_LEVEL2 type we defined, it means that the second (level 2) symbol on the symbols line is triggered when pressing Super key (instead of Shift key).

Finally, edit the ~/.xkb/keymap/mykbd file to load the snippets we wrote:

  • in the xkb_types line add +mytypes(super_level2) inside the quotes
  • in the xkb_symbols line add +mysymbols(super_arrows_home_end) in the quotes.

Now you can load it with

xkbcomp -I$HOME/.xkb ~/.xkb/keymap/mykbd $DISPLAY

Test your left/right keys, they should work as you wanted.

  • 2
    Does not work on Ubuntu 16.04. Super key still opens the Dash Home. Dec 30, 2016 at 11:07
  • @PeterDotchev Your DE will always come first, so you have to disable or remap the keyboard shortcuts first.
    – owzim
    Apr 27, 2020 at 18:45
  • 1
    You cannot map a key or combination of keys to a combination of keys. You can only map to another key (symbol of key); or to a string. If you happen to know a string (with escape codes and such) that is what you actually want to produce, then you can map to it. So, you should look at what is produced by shift+home on your current keyboard and map to that. Note however that modern programs that allow defining key shortcuts are likely to bypass that; on the other hand they usually let you redefine shortcuts by just typing whatever combination you like. Apr 29, 2020 at 12:27
  • 1
    I am getting the an error when following those instructions: syntax error: line 12 of mysymbols last scanned symbol is: End Error: Error interpreting include file "mysymbols" Exiting Abandoning symbols file "(null)" Error: success in unknown Couldn't write keyboard description to :0 I am running Linux Mint 19 (based of Ubuntu 18). I understand that the original answer is quite old, so probably something has changed in the format. Any hints are appreciated. May 22, 2020 at 13:00
  • 1
    It seems there is a trailing thing at the end of your file that causes a parsing error; how do you create the file ? you typed it yourself or did a cut and paste ? what if you try with an empty mysymbols file ? May 27, 2020 at 19:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .