On my laptop running Gentoo Linux with StumpWM as a window manager, I have a custom keyboard layout called daselt, which I'm using all the time. Until now I've set it by automatically running setxkbmap daselt daselt at startup, but the trouble is that this only sets it for keyboards that are always connected (such as my laptop keyboard), but not external keyboards that have to be re-added after suspend, for instance. What I'd like to do is set the keyboard layout as a default that all keyboards are set to when they are connected. So I ran

sudo localectl set-x11-keymap daselt "" daselt

and it produced the file 00-keyboard.conf, whose contents are

# Written by systemd-localed(8), read by systemd-localed and Xorg. It's
# probably wise not to edit this file manually. Use localectl(1) to
# update this file.
Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "daselt"
        Option "XkbVariant" "daselt"

Yet, when I, for instance, suspend my laptop, then wake it up again, my external keyboard, it is added with the normal en-us layout. How can I make it so the daselt layout is automatically applied to all added keyboards?

  • Could it be as simple as using the Settings tool of whatever desktop environment you use and setting the layout there? I don't remember ever seeing this problem (layout changing on suspend) on any system I've used. You mention X11, so I assume you do have some desktop environment running, right? Or is this pure X?
    – terdon
    Commented yesterday
  • @terdon I'm running StumpWM as a window manager. Stump has a plugin for switching keyboard layouts, but I think it's mostly just a simple interface to setxkbmap and I remember having had problems with getting it to work. I'll look it up though and see if it does anything more than that. Commented yesterday
  • @terdon Yeah, as I thought, the plugin is basically just a wrapper around setxkbmap. Commented yesterday
  • 1
    @terdon I don't think the setting is getting lost. The internal keyboard of my laptop remains configured to that layout even after I suspend and restart the laptop. I think the keymap does not remain for an external keyboard because the system re-scans peripherals upon wake-up and applies the standard keymap to any keyboards it finds, which apparently it still sees as the en-us map. At least that's what I think is going on. Commented yesterday
  • 1
    Ah, I see. Crap, then we will probably need to tweak udev...
    – terdon
    Commented yesterday

1 Answer 1


It seems the problem was that I ran

localectl set-x11-keymap daselt "" daselt

as root. I ran the same command as my normal user and it seems to have worked.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .