diff --git a/pmf-suspend b/pmf-suspend new file mode 100644 index 0000000..6b67416 --- /dev/null +++ b/pmf-suspend @@ -0,0 +1,24 @@ +#!/bin/bash + +# Check if the user is using sudo. +if [[ $EUID -ne 0 ]]; then + echo "This script must be run as root, use \"sudo pmf-suspend\" instead." 1>&2 + exit 1 +fi + +# Set user +user="stina" + +# If the user entered anything after the command, assume it is a command for sleep. +if [ "$1" != "" ]; then + eval "sleep $1" +fi + +# Execute scripts + +# Lock screen +sudo -u $user gnome-screensaver-command --lock + +# Suspend computer +sudo pm-suspend +