Today's stupid question: remapping AltGr to control?

Dirk Wallenstein halsmit at t-online.de
Wed Jun 9 00:44:51 PDT 2010


On Tue, Jun 08, 2010 at 04:14:48PM +0100, David Gerard wrote:
> I have a Dell Mini 9 running Ubuntu 10.04 (xorg-server
> 2:1.7.6-2ubuntu7). I don't use the AltGr key *ever*, and am really
> missing having a right Control key.
> 
> Can I remap AltGr to be a control key? So far I've failed utterly with
> xmodmap and xkeycaps. Failed xmodmap command:
> 
>   xmodmap -e "keysym Alt_R = Control_L"
> 
> xkeycaps says that it thinks it's a Control but doesn't have a modifier.
> 
> Can this actually be done?

Xmodmap is ... not optimal. Applying the changes through an XKB keymap
is more reliable and allows more changes. And in this case it's not much
more complicated if you just want to switch the keys.

Determine the keycodes with xev.

Extract the keymap:
$> xkbcomp ${DISPLAY} keymap.xkb

Edit the keymap. At the top is the mapping from symbolic-names (eg <RCTL>)
to keycodes (eg 105). Within XKB all keys are addressed by symbolic names.
You could just exchange the keycodes for AlgGr and Control.
  <RCTL> = 105;
  <KPDV> = 106;
  <PRSC> = 107;
  <RALT> = 108;

Load the keymap:
$> xkbcomp keymap.xkb ${DISPLAY} 

For xmodmap, this might be helpful:
https://bugs.freedesktop.org/show_bug.cgi?id=24552#c9

-- 
Greetings,
Dirk



More information about the xorg mailing list