Skip to content

Instantly share code, notes, and snippets.

@materemias
Forked from jmz-b/plasma-restart.service
Created May 1, 2021 09:52
Show Gist options
  • Save materemias/3ef8e7f6a1e0ee4440fc1cb802816e65 to your computer and use it in GitHub Desktop.
Save materemias/3ef8e7f6a1e0ee4440fc1cb802816e65 to your computer and use it in GitHub Desktop.
restart KDE Plasma on resume from sleep (helps with nvidia video memory corruption problems)
#~/.config/systemd/user/plasma-restart.service
#systemctl --user enable plasma-restart.service
#systemctl --user start plasma-restart.service
#systemctl --user status plasma-restart.service
#systemctl --user stop plasma-restart.service
#sudo loginctl enable-linger <username>
#systemctl --user daemon-reload
#systemctl --user daemon-reexec
[Unit]
Description=Restart plasmashell after resuming
After=suspend.target
StopWhenUnneeded=yes
[Service]
User=root
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/sudo -u $USER /bin/bash -lc 'kquitapp5 plasmashell'
ExecStop=/usr/bin/sudo -u $USER /bin/bash -lc 'plasmashell > /dev/null 2>&1 & disown; sleep 2; exit'
[Install]
WantedBy=sleep.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment