SDDM keyboard layout

I am using Plasma 5 in Gentoo Linux ~amd64 with OpenRC on my Compal NBLB2 laptop. The Display Manager I am using is SDDM, and the log-in screen was using the US keyboard layout, the only keyboard layout available in the log-in screen’s keyboard menu. Searching the Web told me that SDDM uses the keyboard layout specified in the file /etc/X11/xorg.conf.d/00-keyboard.conf. The trouble is, it doesn’t (at least not in my case). The file already existed in my installation, and its contents are listed below:

Section "InputClass"
    Identifier "keyboard"
    MatchIsKeyboard "yes"
    Option "XkbLayout" "gb,us,br,es"
    Option "XkbVariant" ""
    Option "XkbOptions" "grp:alt_shift_toggle"

The X.Org keyboard layouts specified in the file are available once I have logged in to the Plasma 5 Desktop, but none of the four keyboards (gb, us, br and es) were displayed by SDDM in its log-in screen menu. Eventually I discovered it is possible to specify the keyboard layouts in the file /usr/share/sddm/scripts/Xsetup which, by default, contains only the following:

# Xsetup - run as root before the login dialog appears

I edited the file to contain the list of keyboards I wanted SDDM to allow me to choose from on the log-in screen:

# Xsetup - run as root before the login dialog appears
setxkbmap gb,us,br,es

Now the SDDM log-in screen displays the national flags of those four keyboard languages in its keyboard menu, and I can select which keyboard layout to use for typing my password to log in to the Plasma 5 Desktop.

ADDENDUM (October 23, 2016): If you are fed up with upgrades overwriting the change you made to the file /usr/share/sddm/scripts/Xsetup, add the Bash script 30sddm_Xsetup.start in the directory /etc/local.d/, containing the following:

# Make sure the keyboards that I use are selectable on the SDDM greeter screen.
if ! grep setxkbmap /usr/share/sddm/scripts/Xsetup 1> /dev/null
    echo "setxkbmap gb,us,br,es" >> /usr/share/sddm/scripts/Xsetup

About Fitzcarraldo
A Linux user with an interest in all things technical.

3 Responses to SDDM keyboard layout

  1. Christian Gleerup says:

    thanks, finally solved same problem šŸ™‚

  2. David says:

    Thanks a lot!
    This addendum is a good idea.

  3. whitslack says:

    Rather than following your addendum, the “Gentoo way” to protect your changes is to add /usr/share/sddm/scripts/Xsetup to CONFIG_PROTECT in your /etc/portage/make.conf file. Then you’ll be prompted (by etc-update or dispatch-conf) to merge any upstream changes to that file with your changes.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: