#!/bin/sh # This program is free software: you can redistribute it and/or modify it under # the terms of the GNU Affero General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more # details. main() { # Handle opts while getopts ":S:h" opt do case "$opt" in S) rundir=$OPTARG ;; h) usage && exit 0 ;; *) printf "Invalid option passed: %s\n" "$OPTARG" >&2 ;; esac done shift $(( OPTIND - 1 )) # Set default values [ -z "$rundir" ] && rundir="$XDG_RUNTIME_DIR/xblank" # Check if xblank is currently paused if [ "$(head -n 1 "$rundir/paused")" = "0" ] then # xblank is currently not paused printf "1\n" > "$rundir/paused" notify "stock_lock-open" "xblank" "Paused" else # xblank is already paused printf "0\n" > "$rundir/paused" notify "stock_lock" "xblank" "Unpaused" fi } notify() { icon=$1 shift notify-send -i "$icon" -n 26012 -s -t 3 "$@" } usage() { cat <