I'd like to use the right ALT key as 'mod4' (most notably because, by default, the 'awesome' window manager is using mod4 as a modifier for most WM commands and I like that idea a lot).

However I've got an issue: as soon as I add:

xmodmap -e 'add mod4 = Alt_R'

then I cannot use, say, CTRL+ALT+F2 to switch from X to a text console.

(note that I always used left ALT to do that, not right ALT: actually before assigning right ALT to mod4 I was never ever using that key)

It's really a problem with the shortcut / modifiers since that I can still switch from X to a text console by using, say, the chvt command. For example the following always works fine:

chvt 1

As soon as I clear mod4:

xmodmap -e 'clear mod4'

I can use CTRL+ALT+F2 (left ALT once again) to switch to my text console.

But of course then I don't get the nice default mod4+... 'awesome' shortcuts.

So basically I can either use right ALT as mod4 and have awesome work fine or I can clear mod4 (not assigning right ALT to any modifier) and be able to use CTRL+ALT+F2 to swith to a text console.

But I cannot do both.

Do any of you know why configuring right ALT as mod4 prevents CTRL+left ALT+F2 from switching to a text console?

Here's the full xmodmap (when CTRL+left ALT+F2 is not working):

shift   Shift_L (0x32), Shift_R (0x3e)
control Control_L (0x25), Control_L (0x42), Control_R (0x69)
mod1    Alt_L (0x40), Alt_L (0xcc), Metal_L (0xcd)
mod2    Num_Lock (0x4d)
mod4    Alt_R (0x6c)
mod5    ISO_Level3_Shift (0x5c), Mode_switch (0xcb)

Once again clearing that mod4 and I can switch to a text console fine...

I'm not interested in using another setup than:

  • right ALT as mod4

  • mod4+... as shortcuts for awesome

  • CTRL+ALT+F{1,9} to switch to a different VT

Now of course I can use "chvt" to switch to a text console, but that wouldn't work that great should my X be stuck.

I always like to have the possibility to switch to a text console to, say, kill X if it's stuck (been doing that since the early days of slackware).

  • What does right alt produce in xev? Also see this answer on Ask Ubuntu
    – jasonwryan
    Jul 26, 2012 at 3:48
  • @jasonwryan: xev says keysym 0xffea, Alt_R (checking the ask Ubuntu thinggy) Jul 26, 2012 at 4:58
  • 1
    Then I would try adding the remove line to explicitly offload whatever it is initially mapped to before assigning it to mod4.
    – jasonwryan
    Jul 26, 2012 at 5:22

1 Answer 1


When trying to use similar window managers (xwem, ratpoison) for the first time, I first also tried to follow the setup instructions involving xmodmap to get a modifiier key for the window manager, but then I felt that using xmodmap in my system causes some mess, because in my system (an ALTLinux distro) attention has always been paid to multilingual keyboard configuration via XKB, rather than via xmodmap.

So, I found an XKB option to label the key I wanted as "Hyper", and then used the "Hyper" modifier in the configuration for xwem or ratpoison.

In my case, the option to setxkbmap is:

 -option altwin:hyper_win

and here is the comment I've saved on the occasion of adding it to my setup:

xemacs-xwem uses Hyper, so I found this predefined XKB map (in xkb/symbols/altwin), which uses the WIN keys.

Perhaps later I'll make up another XKB map for me, say, using the right Control as Hyper (that will force my hand to use the right Control--now my hand just ignores it).

I thought it's a more clean way to get myself a Hyper key through XKB rather than through xmodmap (as described in XWEM docs), because:

  1. xmodmap configuration of modifier keys seems not to be nice w.r.t. the way it forces one to present one's intentions: one must say something about arbitrarily numbered modifier bits, but I don't want to think about these technical things: I need merely a "Hyper" modifier, not some obscure manipulations with the internals! In xmodmap, I'd need to give 2 or even 3 obscure statements to achieve the result, although logically this is a single wish and operation. (One xmodmap statement would not be enough, cf. XEmacs' warnings (FIXME: insert!) if you map Control_R to a modN; there are some technical constraints.)

  2. one is told stories that XKB and xmodmap don't play well together, so that not all X programs will work nicely and coherently if you mix them (I must give a link here, FIXME).

Here is the relevant definition from /usr/share/X11/xkb/symbols/altwin, if someone is interested:

partial modifier_keys 
xkb_symbols "hyper_win" {
    key <LWIN> {    [   Hyper_L         ]   };
    key <RWIN> {    [   Hyper_R         ]   };
    modifier_map Mod4   { Hyper_L, Hyper_R };
  • Ivan Zakharyasch: thanks a lot... I got your xmodmap / xkb point! I ended up doing something very similar, only using xkb. No more xmodmap here : ) Dec 1, 2012 at 16:57

You must log in to answer this question.

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