9.8.09
xkb and xmodmap: a big mess
So I've convinced myself to try a new keyboard mapping; arensito is currently the only word that I can type quickly and accurately.
I thought that I would take a moment to write down the steps that it took to get a mapping with an extensive and unusual Alt-gr map up and running (on Linux). What is available online is exceedingly unhelpfull.
1. I used Mod_switch rather than ISO_level3_Shift. ISO is the 'correct' choice, but by default N and J cannot be level shifted; fixing that requires xkb, and xkb is evilly difficult to use.
2. Speaking of xkb and evil, Mod_switch won't always work unless xkb is off. So in xorg.conf:
Make sure to comment out all the xkb rules. In .xsession or .xinitrc or wherever you put scripts that run before your X session starts:
3. Edit .Xmodmap:
(note that I use the spacebar as my Mode_switch; chances are you want someting different)
Mode_switch uses the third and fourth keysyms; 'j' and 'J' are the first and second, 'plus' is the third. space+j will return '+'.
Please understand that this is the wrong way to do this; the 'right' way is to use xkb. However, rolling your own xkb mapping is a major undertaking, while xmodmap is reasonably simple. Disabling xkb as I have done here is not reccomended generally, and can apparently cause problems if you use compositing. Nevertheless, this solution works for me.
I thought that I would take a moment to write down the steps that it took to get a mapping with an extensive and unusual Alt-gr map up and running (on Linux). What is available online is exceedingly unhelpfull.
1. I used Mod_switch rather than ISO_level3_Shift. ISO is the 'correct' choice, but by default N and J cannot be level shifted; fixing that requires xkb, and xkb is evilly difficult to use.
2. Speaking of xkb and evil, Mod_switch won't always work unless xkb is off. So in xorg.conf:
Section "InputDevice"
Identifier "Keyboard0"
Driver "keyboard"
Option "CoreKeyboard"
Option "XkbDisable" "true"
# Option "XkbRules" "xorg"
# Option "XkbModel" "latitude"
# Option "XkbLayout" "us"
EndSection
Make sure to comment out all the xkb rules. In .xsession or .xinitrc or wherever you put scripts that run before your X session starts:
export XKB_DISABLE=1
3. Edit .Xmodmap:
keycode 44 = j J plus
keycode 0x41 = Mode_switch
clear mod3
add mod3 = Mode_switch
(note that I use the spacebar as my Mode_switch; chances are you want someting different)
Mode_switch uses the third and fourth keysyms; 'j' and 'J' are the first and second, 'plus' is the third. space+j will return '+'.
Please understand that this is the wrong way to do this; the 'right' way is to use xkb. However, rolling your own xkb mapping is a major undertaking, while xmodmap is reasonably simple. Disabling xkb as I have done here is not reccomended generally, and can apparently cause problems if you use compositing. Nevertheless, this solution works for me.
Labels: arensito