XkbOptions
refers to a rule defined in the XKB rules file, normally /usr/share/X11/xkb/rules/base
, which will look like:
terminate:ctrl_alt_bksp = +terminate(ctrl_alt_bksp)
That in turn picks up the definition from the terminate symbols file, normally /usr/share/X11/xkb/symbols/terminate
. I'm not sure if you can just add more modifiers to the type="CTRL+ALT"
line there or if there's limits on the type value.
Documentation on XKB customization can be found at http://www.x.org/wiki/XKB and may be able to help fill in some of the gaps in this answer.
Run the command xev
. In the xev window, press the AltGr key. You'll see something like
KeyPress event, serial 29, synthetic NO, window 0x6400001,
root 0x105, subw 0x0, time 966635535, (243,-207), root:(1891,26),
state 0x0, keycode 66 (keysym 0xff7e, Mode_switch), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
Note the keycode; since the key isn't doing what you want, you'll see something else (possibly Alt_R
) instead of Mode_switch
. You want to assign this keycode to Mode_switch
, which is X11's name for AltGr. Put the following command in a file called .Xmodmap
(note capital X
) in your home directory:
keycode 66 = Mode_switch
Additionally, you may need to assign a modifier to Mode_switch
, but if all that's happening is a keycode discrepancy there'll already be one. See Set the key for spanish eñe letter for more information.
Run xmodmap ~/.Xmodmap
to test your file. On many systems, including Ubuntu 10.04, this file is loaded automatically in the default Gnome environment. On other distributions or environments, you may need to indicate explicitly that you want to run xmodmap ~/.Xmodmap
when you log in.
Best Answer
I face the same issue. The magic trick is in the order of the keys. You have to:
Ctrl
Shift
Ctrl
If you release the Ctrl before Shift, or use any other order, you will face the issue. Pressing those keys together at the same time makes the order random.
BTW. It doesn't depend on the WM at all. It seems to be Xephyr related.