i3exit 898 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/usr/bin/env bash
  2. # /usr/bin/i3exit
  3. # with openrc use loginctl
  4. [ "$(cat /proc/1/comm)" = "systemd" ] && logind=systemctl || logind=loginctl
  5. case "$1" in
  6. lock)
  7. # blurlock
  8. $HOME/.myScripts/system_exit/lock.sh
  9. ;;
  10. logout)
  11. i3-msg exit
  12. ;;
  13. switch_user)
  14. dm-tool switch-to-greeter
  15. ;;
  16. suspend)
  17. $HOME/.myScripts/system_exit/lock.sh && $logind suspend
  18. # blurlock && $logind suspend
  19. ;;
  20. hibernate)
  21. $HOME/.myScripts/system_exit/lock.sh && $logind hibernate
  22. # blurlock && $logind hibernate
  23. ;;
  24. reboot)
  25. $logind reboot
  26. ;;
  27. shutdown)
  28. $logind poweroff
  29. ;;
  30. *)
  31. echo "== ! i3exit: missing or invalid argument ! =="
  32. echo "Try again with: lock | logout | switch_user | suspend | hibernate | reboot | shutdown"
  33. exit 2
  34. esac
  35. exit 0