DEV Community

Aidas Petryla
Aidas Petryla

Posted on

3 1 1 1 1

Effortlessly add new characters to Your keyboard layout

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!

Image of Datadog

Measure and Advance Your DevSecOps Maturity

In this white paper, we lay out a DevSecOps maturity model based on our experience helping thousands of organizations advance their DevSecOps practices. Learn the key competencies and practices across four distinct levels of maturity.

Get The White Paper

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs