Since I did not receive any answer to this question and I have to manually restart gnome-shell each time the PC comes back from suspend to correct the distorted colors, I would like to know how to automatically restart Gnome Shell after suspend instead of doing Alt + F2 - r.
Installed Gnome extensions: Dash to Panel and Arc Menu. This is not a duplicate of a previous question. This specifically about automatically restarting Gnome Shell after coming out from suspend. Questions are totally different.
Edit: following the suggestions on comments:
a. Created a file on /etc/systemd/system called restart-gnome-shell.service and add the following:
[Unit]
Description=Restart Gnome-Shell
Before=sleep.target
StopWhenUnneeded=yes
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStop=-/path/to/script.sh
[Install]
WantedBy=sleep.target
The script.sh contents are:
#! /bin/bash
gnome-shell --replace
The script has execution permissions and I enabled and started the service which was recognized by systemctl. This did not work.
This is the status after waking up from suspend:
● restart-gnome-shell.service - Restart Gnome-Shell
Loaded: loaded (/etc/systemd/system/restart-gnome-shell.service; disabled; vendor preset: enabled)
Active: inactive (dead)
jul 08 12:51:07 Enrique-PC systemd[1]: Started Restart Gnome-Shell.
jul 08 15:53:08 Enrique-PC systemd[1]: restart-gnome-shell.service: Unit not needed anymore. Stopping.
jul 08 15:53:08 Enrique-PC systemd[1]: Stopping Restart Gnome-Shell...
jul 08 15:53:08 Enrique-PC restart-gnome-shell.sh[2119]: Window manager warning: Unsupported session type
jul 08 15:53:08 Enrique-PC systemd[1]: Stopped Restart Gnome-Shell.
b. Created an executable script on /lib/systemd/system-sleep with the following contents:
case "${1}" in
post)
gnome-shell --replace
;;
esac
It did not work.
gnome-shell --replace
.