Converting SDDM to wayland only

Currently considering the following:

  1. install the weston package
  2. Update the session config to use weston
more /etc/sddm.conf.d/50-ubuntu-budgie.conf
[Theme]
Current=ubuntu-budgie-login
ThemeDir=/usr/share/sddm/themes
CursorTheme=Breeze_Light
CursorSize=24

[General]
DisplayServer=wayland

[Wayland]
CompositorCommand=weston --shell=kiosk --config=/etc/weston.ini


Create a file /etc/weston.ini to initialise weston as follows:

more /etc/weston.ini
[libinput]
enable-tap=true

[core]
renderer=pixman
xwayland=false
idle-time=0

Thats it - reboot and this makes SDDM wayland only. Do try and let me know your thoughts. Well worth experimenting just list the above with other wayland compositors

There’s just one problem: the keyboard is in QWERTY mode, which can make it difficult to type in the password.

… not really my area … But found this snippet. Sounds plausible. Weston supports keyboard mapping via a section you can add to the ini file

[keyboard]

keymap_rules=evdev

keymap_layout=us,gb # Replace with your desired layout(s)

keymap_variant=

keymap_options=grp:alt_shift_toggle # Optional: Shortcut to switch between layouts

But it might be simpler because on the kde forums it says weston uses the global keyboard layout via something like this

sudo localectl set-x11-keymap fi,us

Thanks, David, but the snippet prevents the system from booting: the login screen doesn’t appear.

Here is the output of localectl status:

System Locale: LANG=fr_FR.UTF-8
    VC Keymap: (unset)         
   X11 Layout: fr
    X11 Model: pc105
  X11 Variant: latin9

That said, ever since I installed Weston, a system error message sometimes appears a short time after the system boots up — could this be related?

Found it!

Check your language setting:

localectl status

Then edit the Weston configuration file — for sd, follow this link :

sd gedit /etc/weston.ini

… and add these two lines, adjusting the language setting as needed:

[keyboard]
keymap_layout=fr

Reboot.


I think it is possible to not edit the weston.ini file - the concern I have here is that the installer will be writing to a global location and we don’t have the opportunity to get the installer to write to a specific location like “/etc/weston.ini”

From googling I have tried to gather the following - whether this actually all works will need more development, but should spark ideas.

write the following bash script to a file name /usr/local/libexec/sddm-xkb-env

#!/bin/bash

set -e

OUT="/run/sddm-xkb.env"
CONF="/etc/X11/xorg.conf.d/00-keyboard.conf"

layout=""
variant=""
options=""

if [[ -f "$CONF" ]]; then
    layout=$(grep -i 'Option "XkbLayout"' "$CONF" | awk '{print $3}' | tr -d '"')
    variant=$(grep -i 'Option "XkbVariant"' "$CONF" | awk '{print $3}' | tr -d '"')
    options=$(grep -i 'Option "XkbOptions"' "$CONF" | awk '{print $3}' | tr -d '"')
fi

# Fallback to localectl if file missing or incomplete

if [[ -z "$layout" ]]; then
    layout=$(localectl status | grep "X11 Layout" | cut -d: -f2 | xargs)
fi

cat > "$OUT" <<EOF
XKB_DEFAULT_LAYOUT=$layout
XKB_DEFAULT_VARIANT=$variant
XKB_DEFAULT_OPTIONS=$options
EOF

Change the permissions on the file

chmod 0755 /usr/local/libexec/sddm-xkb-env

Write the following into a file /etc/systemd/system/sddm.service.d/30-xkb-env.conf

[Service]
ExecStartPre=/usr/local/libexec/sddm-xkb-env
EnvironmentFile=-/run/sddm-xkb.env

Apply the changes

systemctl daemon-reexec
systemctl daemon-reload

What all of the above does is try to get the keyboard layout from whereever the installer writes its keyboard stuff to. Writes a temporary file (in /run) with environment variables

SDDM then preloads that environment file - and should set the layout accordingly.

Sorry, I disabled my edit to weston.ini, followed the instructions to the letter, and rebooted, but the keyboard on the login screen is back in QWERTY mode.

ok - lets debug

sudo cat /run/sddm-xkb.env

sudo systemctl cat sddm

cat /proc/$(pidof weston)/environ | tr ‘\0’ ‘\n’ | grep XKB

journalctl -b -u sddm | grep sddm-xkb-env

Assuming the keyboard stuff is extracted correctly from those system locations we could always get the sddm script to write to our /etc/weston.ini instead. But lets confirm your current setup first.

sudo cat /run/sddm-xkb.env
         
XKB_DEFAULT_LAYOUT=fr
XKB_DEFAULT_VARIANT=
XKB_DEFAULT_OPTIONS=
sudo systemctl cat sddm

# /usr/lib/systemd/system/sddm.service
[Unit]
Description=Simple Desktop Display Manager
Documentation=man:sddm(1) man:sddm.conf(5)
# Change this if you want to start sddm in a different tty
Conflicts=getty@tty1.service
After=getty@tty1.service

# If using tty1 and plymouth, sddm will fail till plymouth stops
# consider using:
## After=plymouth-quit.service
# or to forcefully stop plymouth and start earlier:
## Conflicts=plymouth-quit-wait.service
## After=plymouth-start.service plymouth-quit-wait.service
## OnFailure=plymouth-quit.service

# Ordering
Conflicts=plymouth-quit-wait.service
After=systemd-user-sessions.service plymouth-start.service plymouth-quit-wait.s>
OnFailure=plymouth-quit.service

[Service]
# temporary safety check until all DMs are converted to correct
# display-manager.service symlink handling
ExecStartPre=/bin/sh -c '[ "$(cat /etc/X11/default-display-manager 2>/dev/null)>
ExecStart=/usr/bin/sddm
Restart=always
RestartSec=1s
EnvironmentFile=-/etc/default/locale

[Install]
Alias=display-manager.service

# /etc/systemd/system/sddm.service.d/30-xkb-env.conf
[Service]
ExecStartPre=/usr/local/libexec/sddm-xkb-env
EnvironmentFile=-/run/sddm-xkb.env
cat /proc/$(pidof weston)/environ | tr ‘\0’ ‘\n’ | grep XKB

cat: /proc//environ: No such file or directory
journalctl -b -u sddm | grep sddm-xkb-env