i3exit.sh 486 B

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