Via the System Settings I’ve set the Lock screen to show the clock but not the media controls. But something else I’d like on the lock screen would be the text of the kernel version. That is, it would be nice if the “uname -r” string could be injected to show on the lock screen. Is there any way to do that? I’d like to do the similar thing to the SDDM login screen.
This would be useful as a “motd” (message of the day) type functionality
Yes, but you’d have to edit both.
For SDDM you find a theme closest to what you want and then make your own theme with the changes you want.
The lock screen is more difficult, as it doesn’t really allow theming. I do know that apart from manually editing the files there is an option to have code run that over-rides parts of it, but although that is on my todo list I haven’t yet gotten to the point where I can advise on that.
Files:
/usr/share/plasma/shells/org.kde.plasma.desktop/contents/lockscreen
And:
/usr/share/kconf_update/
I rolled my own “hack” way of doing this by making this rc.local file to run at boot time
#!/bin/bash
#
# rc.local
#
# LOCKLINK sym link points to the unchanged input file
LOCKLINK="/home/mos/Pictures/lock-login"
# ex: /home/mos/Pictures/mybackgnd.png if the link pointed to that
LOCKFILE="$(readlink -f "$LOCKLINK")"
# ex: png, etc
ext=${LOCKFILE##*.}
# ex: /home/mos/Pictures/lock-login-out.png
LOCKIMAGE="${LOCKLINK}-out.$ext"
#echo "LOCKLINK: $LOCKLINK ---> LOCKFILE: $LOCKFILE"
#echo "LOCKIMAGE: $LOCKIMAGE"
function lockscreen()
{
# this time check doesn't seem to work for sym links
if [[ ! -e "$LOCKIMAGE" || $(stat -c '%W' "$LOCKLINK") -gt $(stat -c '%W' "$LOCKIMAGE") ]]; then
# only bother running magick if the link postdates the image
# first clear out all stale images
rm -f ${LOCKLINK}-out*
# make the new one
magick "$LOCKLINK" -gravity North -background yellow -fill black -splice 0x32 \
-pointsize 24 -annotate +0+2 "$(uname -r)" "$LOCKIMAGE"
chown mos:mos "$LOCKIMAGE"
else
:
# echo "$0 lockscreen skip"
fi
}
function loginscreen()
{
if ! systemctl is-enabled gdm >/dev/null; then
# don't consider this case an error, in SDDM LM this gdm hack isn't need so just
# return
#echo "$0 loginscreen() - error GDM required"
return
fi
local GDMFILE=/etc/dconf/profile/gdm
local LOGOFILE=/etc/dconf/db/gdm.d/01-logo
local CORPFILE=/etc/dconf/db/gdm.d/01-corp-login
local BANNERFILE=/etc/dconf/db/gdm.d/01-banner-message
if [[ ! -e "$GDMFILE" ]]; then
# inject a template of the gdm file if missing
cat << EOF > "$GDMFILE"
user-db:mos
system-db:gdm
file-db:/usr/share/gdm/greeter-dconf-defaults
EOF
fi
#local mode='image'
local mode='banner'
echo "$0 loginscreen mode: $mode $LOCKIMAGE"
if [[ $mode == 'banner' ]]; then
# BANNER
rm -f "$CORPFILE"
# insert the kernel version string between the two tick marks
# text message version
cat << EOF > "$BANNERFILE"
[org/gnome/login-screen]
banner-message-enable=true
banner-message-text=">>> Kernel $(uname -r) <<<"
EOF
elif [[ $mode == 'image' ]]; then
# IMAGE
rm -f "$BANNERFILE"
# image version, always recreate the file since the LOCKIMAGE might
# have changed from jpg to png or vis versa
cat << EOF > $CORPFILE
[org/gnome/desktop/background]
picture-uri='file://$LOCKIMAGE'
EOF
else
echo "error unknown $mode"
fi
dconf update
}
# comment these out to disable this
lockscreen
loginscreen
#echo "LOCKLINK: $LOCKLINK"
#echo "LOCKIMAGE: $LOCKIMAGE"
#echo "LOCKFILE: $LOCKFILE"
#echo "$(stat $LOCKIMAGE)"
What this does is literally inject a string which is the uname -r
into the lock screen image at boot time. I guess the weirdest thing is using ImageMagick “magick” command to inject the uname -r into the actual image at boot time.
Then the “WallpaperFader” code was commented out in file:
/usr/share/plasma/shells/org.kde.plasma.desktop/contents/lockscreen/LockScreenUi.qml
/* prevent fade/fuzz of image WallpaperFader {
anchors.fill: parent
state: lockScreenRoot.uiVisible ? "on" : "off"
source: wallpaper
mainStack: mainStack
footer: footer
clock: clock
} */
(optionally if trying to use sddm, comment the similar one in /usr/share/sddm/themes/breeze/Main.qml )
…because the lock screen seems to fuzz the image. That would be something else I’d like KDE not to do (why fuzz up the image? I guess someone thought seeing the image makes it hard to type the password) so it would be nice if there was a way to opt out of the login/lock screen image “fuzzing”.
The final lockscreen step is to point the lock screen image using “System Settings” to “lock-login-out.jpg” or “lock-login-out.png” depending on the image used. The lock-login.{png|jpg} in the users ~/Pictures/ is a sym link the original image so the image used can be changed easier and it’s not necessary to edit the rc.local for that.
I gave up on trying to get sddm to show the modified image because it zooms in on the image for some reason. I guess if I really tried I could get the “magick” command in the lockscreen function() setup to position the string image to be seeable even when zoomed in with SDDM but for now I gave up.
So I changed the login manager to gdm and used GDM text showing capability via the “banner-message-text” string.
1 Like
Yeah, I’m not surprised you had to do all that.
Unfortunately the whole setup is designed to look good only used one way and it takes a lot of effort to change it to anything else.
Personally I don’t need a clock (that’s wrong before I log in – GMT), a media player, an avatar (I’m the only user) and a login prompt that sucks if you use LDAP (not a normal system user).
Fortunately the clock and media player is easy to switch off in settings.
I changed my SDDM theme to one without a clock or media play and that remembers me.
Haven’t gotten around to removing the useless avatar on the lock screen yet.
Good point about the fuzziness, thank you, will add to my notes.
I change kernels so often I like to know what the kernel is. Like my PS1 for bash is set:
kver=$(uname -r)
export PS1="[\h ${kver%.fc*} \D{%Y%m%d-%H%M %a day %j}]\n[\u \w] $ "
to show:
[dell 6.16.0-0.rc1.17 20250617-0916 Tue day 168]
[testuser ~] $