If you’re using x11 it’s a well known and confirmed bug: 496926 – On X11, desktop is black/missing after resuming from suspend or hibernation until plasmashell is restarted or TTYs are switched
For me it happens after plasma auto locks the screen and only then but others in the thread said it happens at other times too. Amazingly KDE removed the ability to run scripts on system unlock which used to be under notifications but since I wasn’t about to run a command every time I unlocked the screen and I didn’t feel like downgrading Fedora I made a service for this. It is hacky and may not work for everyone so ymmv.
Add /path/to/script/monitor_screen_lock.sh
with content:
#!/bin/bash
dbus-monitor --session "type='signal',interface='org.freedesktop.ScreenSaver'" |
while read -r line; do
case "$line" in
*"boolean true"*)
# Screen is locked
;;
*"boolean false"*)
## Screen is unlocked
plasmashell --replace &
;;
esac
done
chmod +x /path/to/script/monitor_screen_lock.sh
Create a systemd user service at ~/.config/systemd/user/screen_lock_monitor.service
:
[Unit]
Description=Restart plasmashell on session unlock
After=graphical-session.target
[Service]
ExecStart=/path/to/script/monitor_screen_lock.sh
Restart=always
Environment=DISPLAY=:0
Environment=DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
[Install]
WantedBy=default.target
/run/user/1000/bus
needs to match your user ID (id -u
).
Reload the systemd user services:
systemctl --user daemon-reload
Enable the service so it starts on login:
systemctl --user enable screen_lock_monitor.service
Start the service immediately:
systemctl --user start screen_lock_monitor.service