Introduction

As a long-time user of the ISO-DE layout I wanted to get used to the ANSI layout since, being the default, it means less configuration. Additionally, it has faster access to special characters used for programming.

The lack of quick access to characters like °, €, dead key accents, umlauts, or ß however made it really annoying to type at times since I was used to having them quickly available. The obvious solution is Compose key, but I got tired of typing out combinations each time to use simple characters, so I found myself a solution in a small utility called keyd.

Setting up keyd

Configuration

Keyd is a simple daemon that can remap your keyboard inputs on kernel level so they work across every desktop environment, be it X11 or Wayland. In combination with Compose we can use it to bind key combinations to special characters.

The configuration file sits at /etc/keyd/default.conf, which I set it to the following:

[ids]
*
[main]
rightalt = layer(pop)

[pop]
; = macro(compose o ")
[ = macro(compose u ")
' = macro(compose a ")
- = macro(compose s s)
= = macro(compose ')
` = macro(compose ^)
n = macro(compose n ~)
e = macro(compose c =)
shift = layer(pop2)

[pop2]
= = macro(compose `)
` = macro(compose o o)

This allows me to use the right alt key to press regular or special keys where they would be on the ISO-DE layout.

Additional Steps

Apart from starting the keyd daemon with sudo systemctl enable --now keyd it’s also required to set the Compose key to ≣ Menu.

KDE Plasma

On KDE Plasma Wayland, this can be done in the system settings:

Screenshot of the location to set the Compose key to the Menu key in Plasma system settings

Sway

On Sway, it can be set in your sway.conf:

input type:keyboard {
    xkb_layout us,
    xkb_options compose:menu
}

Writing your own shortcuts

If you want to add more keys, you can view all available combinations in /usr/share/X11/locale/en_US.UTF-8/Compose. To overwrite a combination while holding shift, put it into the [pop2] layer.