Search code examples
keyboardx11key-bindingsmodifier

Use xkbdmap (setxkbmap) to map rwin to altgr?


Normally, I can find solutions by just googling around, but I can't find any decent documentation for xkbdmap except for the grossly inadequate man page.

Perhaps I'm going about this the wrong way. I have a US 105 plain old keyboard that does not have an AltGR key. To the right of the space bar, I have Alt, Windows key, some sort of menu key, and then a Control key.

(what's the point of the Windows key and the Menu key - does anyone actually use those?)

Apparently, some keyboard have another key which is the AltGR key. That with E would give you a Euro symbol for instance, apparently.

Because my keyboard doesn't have this key, I thought to use the xkbdmap command like this:

xkbdmap altgr:rwin

Why does this not work?


Solution

  • There's no xkbdmap command in the standard xorg distribution. You probably can use xmodmap but generally things are done slightly differently in the X11 land nowadays. If you use XKB (everybody uses XKB now) then there are virtual modifiers such as "compose" and "meta" and "level 3 chooser" which are mapped to real keys. This is done with the setxkbmap command. You probably want either

    setxkbmap -option -option compose:rwin
    

    or

    setxkbmap -option -option lv3:rwin_switch,eurosign:e
    

    depending on what exactly you want. Google setxkbmap options to figure out your possibilities.

    (The first empty -option argument clears existing options, the second one adds to existing options. If you want to keep existing options, skip the first -option. Current options are stored in the properties of the root window.)

    Note that most keyboards that have AltGr lack the right Alt key. If you want your right Alt to act like AltGr, change rwin to ralt in the above commands.