Advertisement
alaminh

i3exit

Apr 21st, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.74 KB | None | 0 0
  1.  
  2. #!/bin/sh
  3. # /usr/bin/i3exit
  4.  
  5. # with openrc use loginctl
  6. [[ $(cat /proc/1/comm) == "systemd" ]] && logind=systemctl || logind=loginctl
  7.  
  8. case "$1" in
  9.     lock)
  10.         i3lock #before was blurlock
  11.         ;;
  12.     logout)
  13.         i3-msg exit
  14.         ;;
  15.     switch_user)
  16.         dm-tool switch-to-greeter
  17.         ;;
  18.     suspend)
  19.         i3lock && $logind suspend
  20.         ;;
  21.     hibernate)
  22.         i3lock && $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.  
  36. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement