#!/bin/sh [ -z "$1" ] && echo "no arg" && exit 1 host="$(hostname -s)" case $host in mother) icon=" " ;; po-rbo) icon=" " ;; mars) icon=" " ;; esac case $1 in "lock") xscreensaver-command -lock ;; "sleep") notify-send -u normal "sleep" "$icon G'night, partner!" sleep 1 xscreensaver-command -lock sleep 5 case $host in mother) loginctl suspend ;; po-rbo) systemctl suspend ;; mars) acpiconf -s 3 ;; esac ;; "reboot") emacsclient -e '"(save-buffers-kill-emacs)"' >/dev/null 2>&1 notify-send -u normal reboot "$icon Rebootin' now!" sleep 2 case $host in mother) loginctl reboot ;; po-rbo) systemctl reboot ;; mars) shutdown -r now ;; esac ;; "poweroff") emacsclient -e '"(save-buffers-kill-emacs)"' >/dev/null 2>&1 notify-send -u normal poweroff "$icon Farewell, partner!" sleep 2 case $host in mother) loginctl poweroff ;; po-rbo) systemctl poweroff ;; mars) shutdown -p now ;; esac ;; *) echo "wrong arg" exit 1 ;; esac