I have had this annoyance for a while on KDE with an Nvidia card. Apparently it is a long standing on and off bug with some Nvidia cards. My desktop icon text is always corrupted after resuming from suspend. Sometimes other window elements are corrupted and are not displayed properly after resuming. I figured it would eventually get fixed, but thought I'd try to fixing it myself. The video corruption can easily be corrected be rebooting, but I rarely reboot.
The video corruption can also be corrected by restarting the plasmashell with the following command:
kquitapp5 plasmashell; kstart5 plasmashell
Or, other commands such as (preferred):
killall plasmashell; plasmashell > /dev/null 2>&1 & disown
An even easier way, is to create a bash alias to simplify running the command. Research the bash alias function to enable this. With a bash alias I only need to enter "restartps" (or whatever you want) to restart the plasmashell.
alias restartps="killall plasmashell; plasmashell > /dev/null 2>&1 & disown"
I thought creating a systemd unit to accomplish this automatically after resuming would be a great way to automate a plasmashell restart. Unfortunately, the systemd service does not fully accomplish this. The service will kill the plasmashell on resume, but no matter what I've tried I can't find a way to automatically restart it. So, after resume I have to manually refresh my desktop by using my alias I created, which is what I'm trying to automate.
I have tested many different systemd options, but have yet to find a solution to successfully starting the plasmashell, (although it will kill the plasmashell correctly after resume).
This is an example of one of my latest systemd unit files.
#/etc/systemd/system/restart-plasmashell.service #sudo systemctl enable restart-plasmashell.service [Unit] Description=Restart plasmashell after resuming Wants=local-system-resume.service After=suspend.target [Service] Type=simple User=htpc ExecStart=/home/htpc/.scripts/restartps.sh [Install] WantedBy=suspend.target
I also have tried the "forking" and the "oneshot" options without any more success. I have tested other options as well without improvement.
For ease of editing, I have been using an external script in my home directory. I have tested too numerous of versions to keep track of but still no love. Including the commands in the systemd unit worked no better and only slowed testing as when you update the unit file itself the daemon must be refreshed and the service restarted with root permissions. The external script method is just far easier to edit quickly.
Here are some examples of commands I've tested in the external script:
killall plasmashell; sleep 5; plasmashell > /dev/null 2>&1 & disown kquitapp5 plasmashell && kstart5 plasmashell > /dev/null 2>&1 & disown killall plasmashell; sleep 3; kwin_x11 --replace; sleep 5; kstart5 plasmashell & exit killall plasmashell; kwin_x11 --replace & kstart5 plasmashell & exit killall plasmashell; kstart5 plasmashell kbuildsycoca5 && kquitapp5 plasmashell && kstart5 plasmashell kbuildsycoca5 && kquitapp5 plasmashell; sleep 3; kwin_x11 --replace; sleep 5; kstart5 plasmashell & exit kbuildsycoca5 && kquitapp5 plasmashell && plasmashell > /dev/null 2>&1 & disown kquitapp5 plasmashell; kstart5 plasmashell kquitapp5 plasmashell | true && kstart5 plasmashell | true killall plasmashell | true && kstart5 plasmashell | true
Many of these commands work perfectly when issue from the terminal, but will not initiate a plasma restart correctly via the service.