User Tools

Site Tools


system:console:xmodmap

XmodMap

All the funny things you can do using the xmodmap command.

Mapping Umlauts

Though I'm german, I prefer US-layout for my keyboards. This is mainly for two reasons:

  • intensive use of Alt_R leads to worn out joints of my right hand's thumb
  • umlauts weren't working for me in the past anyway.

Since I fixed my earlier problems using umlauts, I now want to at least be able to type them, still using my preferred keyboard layout. This is how I made that possible:

Using xev, I had to find out some things:

  • the Alt_R key has the keycode 113
  • keycodes for a, o, u and s are 38, 32, 30 and 39

The nice command dumpkeys -l shows you the currently available keysyms. It showed me that:

  • the umlauted a, o and u are being called adiaeresis, odiaeresis and udiaeresis and
  • the sharp s is being called ssharp.

Now let's do it:

a first entry in .Xmodmap:

keycode 113 = Mode_switch Alt_R

sets the functionality of the Alt_R key (keycode 113) to Mode_switch by default. When being used shifted, the old functionality is restored.

First a short usage of the keycode statement of .Xmodmap:

keycode CODE = KEY_NORMAL KEY_SHIFTED KEY_MODIFIED KEY_SHIFTED_MODIFIED

placeholder naming should be self-explanatory.

Putting the above together, we can remap a, o, u and s:

keycode 38 = a A adiaeresis Adiaeresis
keycode 32 = o O odiaeresis Odiaeresis
keycode 30 = u U udiaeresis Udiaeresis
keycode 39 = s S ssharp 

that's it.

Home Made Swapcaps

Of course, also Caps_lock and Control can be swapped using xmodmap:

remove Lock = Caps_Lock
remove Control = Control_R
keysym Control_R = Caps_Lock
keysym Caps_Lock = Control_R
add Lock = Caps_Lock
add Control = Control_R

the special feature of this configuration is that Caps_lock is actually swapped with Control_R, so the original function of the left Ctrl-button is sustained. yes, I really have no need for Caps_lock

system/console/xmodmap.txt · Last modified: 2008/01/16 19:50 by 127.0.0.1