i3exit 622 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/sh
  2. lock() {
  3. $HOME/.config/i3lock/i3lock.sh
  4. }
  5. case "$1" in
  6. lock)
  7. lock
  8. ;;
  9. logout)
  10. emacsclient -e '(kill-emacs)'
  11. i3-msg exit
  12. # gnome-session-quit
  13. ;;
  14. suspend)
  15. lock && systemctl suspend
  16. ;;
  17. hibernate)
  18. lock && systemctl hibernate
  19. ;;
  20. reboot)
  21. emacsclient -e '(kill-emacs)'
  22. systemctl reboot
  23. ;;
  24. shutdown)
  25. emacsclient -e '(kill-emacs)'
  26. systemctl poweroff
  27. ;;
  28. *)
  29. echo "Usage: $0 {lock|logout|suspend|hibernate|reboot|shutdown}"
  30. exit 2
  31. esac
  32. exit 0