2

How do I automatically start an application on resume after suspend or hibernate?

The reason I want to do this is because I've created a script to set xinput value on startup application, but after suspend or hibernate the value in xinput back to default.

Nur
  • 4,131

1 Answers1

1

Place the custom shell script in /etc/pm/sleep.d. Here's an example script which restarts autokey-gtk:

#!/bin/bash

case "$1" in
    hibernate|suspend)
        ;;
    thaw|resume)
        pkill autokey-gtk
        nohup autokey-gtk 2>&1 > /dev/null &
        ;;
    *)
        ;;
esac

The script name should start with 99, or something like that. For example: 99_my_resume.bash.

And don't forget to make it executable:

chmod +x 99_my_resume.bash
Adobe
  • 3,971