OPINIONATED OMARCHY
TROUBLESHOOTING CORPUS
790
RECORDS
790
AUDITED
0
UNCHECKED
2388
SOURCES
LIVE
audio-input medium very-common DISPUTE

Set a keyboard layout Hyprland actually applies, not setxkbmap

omarchyarchendeavouroscachyoshyprlandwaylandlaptopdesktop
AUDITED Audited against its sources and confirmed accurate.

Symptom

localectl set-x11-keymap or setxkbmap de has no effect under Hyprland: the layout stays US, or only changes inside XWayland apps. Caps-Lock-as-Escape remaps done "the X11 way" don't work either.

Cause

Wayland compositors do not use the Xorg keyboard configuration path. Hyprland loads its own XKB keymap from its config and pushes it to clients over the Wayland protocol. setxkbmap only talks to an X server, and localectl's X11 keymap is not consulted at all.

Fix

Set the layout in Hyprland's config (Lua, 0.55+):


-- ~/.config/hypr/hyprland.lua
hl.config({
  input = {
    kb_layout = "us,de",
    kb_variant = ",nodeadkeys",
    kb_options = "grp:alt_shift_toggle,caps:escape",
    numlock_by_default = true,
  },
})

On Hyprland 0.54 and older the equivalent hyprlang is:


input {
    kb_layout = us,de
    kb_variant = ,nodeadkeys
    kb_options = grp:alt_shift_toggle,caps:escape
    numlock_by_default = true
}

hyprctl reload

Browse valid values with:


less /usr/share/X11/xkb/rules/evdev.lst
localectl list-x11-keymap-layouts
localectl list-x11-keymap-options | grep caps

For a *specific* keyboard only (name from hyprctl devices):


hl.device({ name = "my-external-keyboard", kb_layout = "de" })

Note that per-device layouts do not change how keybinds resolve unless you also set resolve_binds_by_sym = 1.

Also set the TTY/console layout separately, since it is a different subsystem:


sudo localectl set-keymap de

Verify

hyprctl getoption input:kb_layout shows your layout. Typing in a native Wayland app (e.g. foot, kitty) produces the right symbols, and wev reports the expected keysyms.

Sources

keyboard-layout-not-applied-wayland