The Cookie Machine - Click here to drag window

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

If you can read me, I'm broken!

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

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: December 3, 2023    Layout:  post
TOC: false    Navigation:  false    Copy to clipboard:  false

Change your script from this:

case "${1}" in
         gnome-shell --replace

To this:


case $1/$2 in
    echo "Going to $2..."
    # Place your pre suspend commands here, or `exit 0`
    # if no pre suspend action required
    sleep 1
    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

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?  ⇩