#!/bin/sh lock() { $HOME/.config/i3lock/i3lock.sh } case "$1" in lock) lock ;; logout) emacsclient -e '(kill-emacs)' i3-msg exit # gnome-session-quit ;; suspend) lock && systemctl suspend ;; hibernate) lock && systemctl hibernate ;; reboot) emacsclient -e '(kill-emacs)' systemctl reboot ;; shutdown) emacsclient -e '(kill-emacs)' systemctl poweroff ;; *) echo "Usage: $0 {lock|logout|suspend|hibernate|reboot|shutdown}" exit 2 esac exit 0