2

So, I am trying to map Alt-A to the right arrow. I followed 'xev and xmodmap' approach described here and came up with this:

xmodmap -e "keycode 38 mod1 = Right"

which fails miserably: when I press Alt-A, C is printed. And if I simply press A, the cursor is moved to the right indeed.

Output from xmodmap -pm for mod1 is:

mod1  Alt_L (0x40), Meta_L (0xcd)

What am I doing wrong?

1

As the man page says, or as xmodmap -pke will show:

keycode NUMBER = KEYSYMNAME ...

The list of keysyms is assigned to the indicated keycode (which may be specified in decimal, hex or octal and can be determined by running the xev program). Up to eight keysyms may be attached to a key, however the last four are not used in any major X server implementation. The first keysym is used when no modifier key is pressed in conjunction with this key, the second with Shift, the third when the Mode_switch key is used with this key and the fourth when both the Mode_switch and Shift keys are used.

This means that

keycode 38 mod1 = ...

is illegal syntax.

Also, with xkbd, there can be more than four keysyms, and the additional keysyms behave as specified. For example, with the level3(ralt_switch) xkb-option active (which is the default on my distribution), the right alt key is mapped to ISO3_Level_Shift, and the 5th to 8th keysym describe the results when RAlt is additionally pressed. So in that case, you can do something like

keycode 38 = a A a A Right Right Right Right

or something similar, depending on what you want ShiftAltA etc. to produce.

  • After fixing .Xmodmap to have keycode 38 = a A a A Right Right Right Right and reloading, the mapping does not work and the same weird symbols as are printed as before. Shift+Alt+A produces the capital versions (and I also want to use only Alt without Shift). Any ideas? – user3496846 May 19 '17 at 16:00
  • A bit of investigation showed that the additional keysyms I see come from the level3(ralt_shift) xkb-option. So you need to fiddle with xkb (e.g. in xorg.conf by describing your keyboard), and then you can use xmodmap to change/specify those symbols. – dirkt May 22 '17 at 7:28

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.