Ever wanted to add new characters to the keyboard while keeping Your beloved keyboard layout the same?
That's exactly what I needed to do! I wanted to use german characters Àüâà on my RHEL 8 machine. The problem was that each keyboard layout I could find with those characters was with other symbols in different places. It would be so good if I could simply add a few new characters while keeping the rest of the layout the same, right?
After some googling I came up with the following.
Created a file custom_xmodmap with the contents:
keycode 30 = u U udiaeresis Udiaeresis
keycode 32 = o O odiaeresis Odiaeresis
keycode 38 = a A adiaeresis Adiaeresis
keycode 39 = s S ssharp paragraph
keycode 108 = Mode_switch
Here the keycode 108 is AltGr/Right Alt.
Then executed xmodmap custom_xmodmap
in console. And that's it. Now holding AltGr/Right Alt button down and pressing any of u/o/a/s I get the corresponding german character.
To make the change permanent, I added the last command in the ~/.bashrc.
Some tips for Your particular settings:
For checking the current xmodmap You can use xmodmap -pke
.
For getting the keycodes of the keys, You can use command xev
.
I also found a cool EurKEY package where I could see the examples of the keycodes and keyboard layout.
Hope it makes Your life easier as it made mine!
Top comments (0)