The Cookie Machine - Click here to drag window

DUMMY TEXT - Real text set in assets/js/theCookieMachine.js

Views: 2,311     Votes:  2 
Tags: gnome   suspend   gnome-shell  
Link: 🔍 See Original Answer on Ask Ubuntu 🔗

URL: https://askubuntu.com/q/1053376
Title: How to automatically restart Gnome Shell every time the PC comes out from suspend
ID: /2018/07/09/How-to-automatically-restart-Gnome-Shell-every-time-the-PC-comes-out-from-suspend
Created: July 9, 2018
Upload: November 24, 2022    Layout:  post
TOC: false    Navigation:  false    Copy to clipboard:  false


Change your script from this:

case "${1}" in
    post)
         gnome-shell --replace
;;
esac

To this:

#!/bin/sh

case $1/$2 in
  pre/*)
    echo "Going to $2..."
    # Place your pre suspend commands here, or `exit 0`
    # if no pre suspend action required
    sleep 1
    ;;
  post/*)
    echo "Waking up from $2..."
    # Place your post suspend (resume) commands here, or `exit 0` 
    # if no post suspend action required
    sleep 2
    gnome-shell --replace
    ;;
esac

For sure you are missing #!/bin/sh at the top of your script. Most of the rest of the proposed changes are not be necessary but informative.

⇧ Can I change the font of the text-mode console? Will the fast battery drain on Ubuntu damage my battery?  ⇩