SDDM - locale on login screen (greeter)

Hello all,

I would like to change the locale on the SDDM login screen to use a 24 hour clock format. The greeter seems to run under the sddm user account and I have tried setting the following in the /usr/share/sddm/.config/Xstartup file:

export LANG=en_US.UTF-8
export LC_NUMERIC=da_DK.UTF-8
export LC_TIME=da_DK.UTF-8
export LC_MONETARY=da_DK.UTF-8
export LC_MEASUREMENT=da_DK.UTF-8
export LC_COLLATE=da_DK.UTF-8

Any suggestions will be much appreciated.

By default the startup script used by SDDM is /usr/share/sddm/scripts/Xsetup, but it could have been changed in /etc/sddm.conf (option “DisplayCommand=”).
You could try to export those variables there, but I have no idea whether this will have the desired effect.

And/or set the locale in /etc/sysconfig/language, but that would affect all users then.

Changing the Xsession file didn’t help, but setting the values in /etc/sysconfig/language had the desired effect.

This is okay for a personal machine, but it sure would be nice to specify this for SDDM exclusively somewhere.

Not Xsession, Xsetup!
But then, this might be run too late.

This is okay for a personal machine, but it sure would be nice to specify this for SDDM exclusively somewhere.

Well, you could probably modify the start scripts accordingly.
If you use the generic display-manager.service:
either:
/usr/lib/systemd/system/display-manager.service
/usr/lib/X11/display-manager
/usr/lib/X11/displaymanagers/sddm

If you use the specific sddm.service instead, it’s in /usr/lib/systemd/system/display-manager.service (which starts sddm directly).

Updates will probably overwrite your changes though. In case of systemd’s .service files, you can copy them to /etc/systemd/system/ though and modify the copy.
I’m not sure though what the best way/place would be to set your variables.
Maybe modify the ExecStart line accordingly, to something like:

ExecStart=LC_TIME=da_DK.UTF-8 /usr/bin/sddm

(note, this is untested)

By definition any DM is a system process. The machine does not know Who has started it until the user logs in. :wink:

Right, but SDDM’s greeter (i.e. the login screen that you see) runs as user “sddm” for security reasons.

Btw, “sddm”'s home directory is /var/lib/sddm/, not /usr/share/sddm/. So creating a file in /usr/share/sddm/.config/ doesn’t make any sense anyway (sorry, that I didn’t notice that until now). But I don’t think /var/lib/sddm/.config/Xstartup would help either. Actually “sddm” doesn’t login to an X session at all. Just the SDDM processes run as this user id to be restricted.

Or add drop-in in /etc/systemd/system/display-manager.service.d, like

mkdir -p /etc/systemd/system/display-manager.service.d
cat << \EOF > /etc/systemd/system/display-manager.service.d/50-l18n.conf
[Service]
Environment=LC_TIME=xxx
...
EOF

Neither Xsession nor Xstartup seem to have any effect, if I add statements to them. So I think I’ll stick with my changes to /etc/sysconfig/language for now.

I think the correct action would be to push for an option to set the locale in /etc/sddm.conf

It’s neither Xsession nor Xstartup, it’s Xsetup (in /usr/share/sddm/scripts/) by default.
That’s what you need to change (unless set otherwise in SDDM’s config), not something in /var/lib/sddm/.config or anywhere else.

I’m not sure whether setting the locale envvars there would have effect though.

I think the correct action would be to push for an option to set the locale in /etc/sddm.conf

File a report upstream: