Fixing the broken desktop after resuming from a suspension in Gnome
Este artículo fue publicado hace más de tres años. Ten en cuenta que puede estar desactualizado debido a las nuevas versiones y actualizaciones. Trata de entender los pasos a seguir por si tienes que aplicar cambios durante el proceso.

If you use an Nvidia driver with a Gnome desktop and you decide to resume your system from a suspension or hibernation, you will see that your desktop it's broken like in this screenshot.

 

To fix this problem we need to refresh the Gnome desktop after this happens. We have created a bash script that refresh Gnome desktop after resuming the system. Follow the steps below to implement it in your system:     

1. At your terminal you need to go to the path /lib/systemd/system-sleep/ and create a new file that will contain the bash script.
     You can use the text editor that you prefer, we will use nano.

sudo nano /lib/systemd/system-sleep/broken-desktop-fix

2. Now you can copy and paste in this new file the follow bash script that we mentioned. This script will refresh Gnome desktop each     time you resume after suspension/hibernation.

#!/bin/bash
case "$1" in
  post)
    DISPLAY=:0.0 ; export DISPLAY
    STR="$(users)"
    echo ${STR}
    IFS=' ' read -ra NAMES <<< ${STR}
 
     for i in "${NAMES[@]}"; do
        su $i -c 'dbus-send --type=method_call --dest=org.gnome.Shell /org/gnome/Shell org.gnome.Shell.Eval "string:global.reexec_self()"'
    done;;
esac
  1. After saving the file you will need assign file permissions.
sudo chmod 755 /lib/systemd/system-sleep/broken-desktop-fix
     4. Finally, the script be working. You can try to suspend to check it's fixed after resume.

Also we can do it manually each time it happens with Alt + F2 and then in the text box introduce r and finally press Enter, and Gnome will refresh to fix it.

 


Fixing the broken desktop after resuming from a suspension in Gnome
Eusebio Giner Slimbook
21 noviembre, 2016
Compartir
ArchivO