max-moser/lightdm-elephant-greeter

Change keyboard layout?

Opened this issue ยท 2 comments

Hey there!

I am trying to setup a system without a Xorg server.
So far everything works fine except for the keyboard layout:

  • LightDM starts without crashing
  • Elephant greeter is shown properly

But I cannot login because the greeter uses a QWERTY layout while my keyboard is a German one.

What I have tried so far:

  • Creating the file /etc/X11/xorg.conf.d/20-keyboard.conf (since Wayland still relies on xkb) with following contents:
Section "InputClass"
    Identifier "keyboard"
    MatchIsKeyboard "yes"
    Option "XkbLayout" "de"
    Option "XkbVariant" "nodeadkeys"
EndSection
  • localectl set-x11-keymap de
  • Creating the file /etc/default/keyboard with following contents:
XKBLAYOUT "de"
XKBVARIANT "nodeadkeys"
  • Adding the following environment variables to `/etc/systemd/system/lightdm.service.d/override.conf' config:
[Service]
Environment="XKB_DEFAULT_LAYOUT=de"
Environment="XKB_DEFAULT_VARIANT=nodeadkeys"

Hey, thanks for giving elephant greeter a shot!

Unfortunately, I haven't been using keyboard layouts different from US for a while now, and this issue hasn't even really crossed my mind...

I just quickly checked cage, and it is referencing XKB_DEFAULT_LAYOUT to set the keymap: https://github.com/Hjdskes/cage/blob/master/seat.c#L361
So it looks like that's a promising route at least.

I'll try to have a look at it when I find some time ๐Ÿ™‚

Hey, @HiImJulien !

I found a section about XKB environment variables in cage's wiki.

One possibility to change the keyboard layout would then be to change the Exec line in the lightdm-elephant-greeter.desktop file (worked for me): Exec=env XKB_DEFAULT_LAYOUT=de XKB_DEFAULT_VARIANT=nodeadkeys cage -m last -s -d elephant-greeter.py
Of course that won't help you when you want to change the keyboard layout in the greeter at runtime, but it's better than nothing ๐Ÿ˜