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: 4,264     Votes:  6 
Tag : startup-applications  
Link: 🔍 See Original Answer on Ask Ubuntu ⧉ 🔗

URL: https://askubuntu.com/q/1093350
Title: How to run script after resuming from sleep?
ID: /2018/11/16/How-to-run-script-after-resuming-from-sleep_
Created: November 16, 2018    Edited:  June 12, 2020
Upload: April 8, 2024    Layout:  post
TOC: false    Navigation:  false    Copy to clipboard:  false


Run Script when Resuming from Suspend

Create a new file /lib/systemd/system-sleep/resume and copy in:

#!/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
    exit 0
    ;;
  post/*)
    echo "Waking up from $2..."
    # Place your post suspend (resume) commands here, or `exit 0` 
    # if no post suspend action required
    mouse_script.sh
    ;;
esac

NOTE: replace user mouse_script.sh (third line from the bottom) with your script name. Provide the full path name if the script is not in your path (echo $PATH).

Then mark it executable with the command:

sudo chmod +x /lib/systemd/system-sleep/resume
⇧ Temporarily switch to a full-screen, hairline cursor I'm looking for a command to flash screens (if possible in colors)  ⇩