dot-files/scripts/toggle-xautolock

24 lines
438 B
Plaintext
Raw Permalink Normal View History

#!/bin/sh
case "$1" in
enable|disable)
;;
*)
echo "Unkown command '$1'" >&2
echo "Usage: '$0 <enable|disable>'" >&2
exit 1
;;
esac
notify() {
notify-send -u "${2:-low}" "$1" \
-h string:x-canonical-private-synchronous:xautolock-toggle # Overwrite
}
if ! xautolock "-$1"; then
notify "Could not toggle Xautolock" critical
exit 1
fi
notify "Toggled Xautolock (${1}d)"