LinkedIn logo Xing logo DBLP logo University logo GitLab logo

US keyboard layout with German umlauts via Caps Lock on Sway

Configure a custom XKB layout to type German umlauts (ä, ö, ü, ß) using a US keyboard on Sway, with Caps Lock as a modifier.

First published: 6 September 2025.

I typically use a US keyboard layout because I find it much easier to work in a terminal, write LaTeX documents, or code in any programming language. At some point I came across a snippet for enabling German umlauts on top of the US layout, with Caps Lock as a modifier. I don’t remember the original source, but I’ve kept it because it’s very handy.

Two-step setup

First, create ~/.xkb/symbols/us-german-umlaut with the following content:

default partial alphanumeric_keys
xkb_symbols "basic" {
    include "us"
    include "level3(caps_switch)"
    name[Group1] = "English (US, international with German umlaut)";
    key <AD03> { [ e, E, EuroSign, cent ] };
    key <AD07> { [ u, U, udiaeresis, Udiaeresis ] };
    key <AD09> { [ o, O, odiaeresis, Odiaeresis ] };
    key <AC01> { [ a, A, adiaeresis, Adiaeresis ] };
    key <AC02> { [ s, S, ssharp ] };
};

Second, load the layout in your Sway config (~/.config/sway/config):

input * {
    xkb_layout us-german-umlaut
}

Reload the config and you’re good to go. If you prefer, you can replace the asterisk with the identifier of a specific keyboard.

US German Keyboard for macOS

On macOS, I rely on the US German Keyboard developed at RWTH Aachen University’s Human-Computer Interaction Center.

It follows the same idea: keep the familiar US layout for programming, while making German umlauts (ä, ö, ü) and ß easy to type.

Changing Caps Lock to Option key in macOS keyboard settings.

In macOS Settings → Keyboard → Modifier Keys, the function of the Caps Lock key can be changed to act as the Option key. This way I get consistent behavior across Linux and macOS, which makes switching machines much less confusing.