New Fix For Screen Corruption After Suspend:
I don’t know why my prior service stopped working. Perhaps it was a kernel or driver change (or possibly another factor). Regardless, I went back to the drawing board to find a new solution. The only method that works on my computer to eliminate the screen corruption is a full plasma restart. That is actually much harder to accomplish than you would think.
At first glance this service looks deceptively simple, but it took countless command variations to find this solution. I tried using different environment variables and even an environment file (with all my variables) to try and reload plasma correctly. However, no mater what type of service, or how I tried to restart plasma it would not work 100% correctly…
Then a strange thought occurred to me, Plasma reloads itself after a crash. What if auto-loading itself after a crash loads things in the correct environment all on its own. Bizarrely, forcing a plasma crash was the solution to getting plasma to reload correctly. This fixes the screen corruption issue with a barely perceptible delay after coming out of suspend.
Here is my new service unit.
plasma-restart.service file contents:
#sudo systemctl enable plasma-restart.service
#sudo systemctl start plasma-restart.service
#sudo systemctl stop plasma-restart.service
#sudo systemctl disable plasma-restart.service
#systemctl status plasma-restart.service
#sudo systemctl daemon-reload
Description=Plasma Restart Service
ExecStart=/usr/bin/sudo -u user /bin/sh -a -c 'killall -SIGSEGV plasmashell'
You must subsitute your own username in place of “user” in the “ExecStart=” line of the service.
To enable the plasma-restart.service:
systemctl enable plasma-restart.service