Guest User

Untitled

a guest
Feb 11th, 2020
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. #
  4. # → https://faq.i3wm.org/question/239/how-do-i-suspendlockscreen-and-logout.1.html
  5. #
  6.  
  7. lock() {
  8. # see https://stackoverflow.com/a/331294
  9. img="$TMPDIR/i3lock-$$.png"
  10. img_tmp="$TMPDIR/i3lock-tmp-$$.png"
  11. scrot $img_tmp
  12. convert -scale 10% -scale 1000% $img_tmp $img
  13. i3lock -n -i $img
  14. rm -f $img $img_tmp
  15. }
  16.  
  17. case "$1" in
  18. lock)
  19. lock
  20. ;;
  21. logout)
  22. i3-msg exit
  23. ;;
  24. suspend)
  25. lock && systemctl suspend
  26. ;;
  27. hibernate)
  28. lock && systemctl hibernate
  29. ;;
  30. reboot)
  31. systemctl reboot
  32. ;;
  33. shutdown)
  34. systemctl poweroff
  35. ;;
  36. *)
  37. echo "Usage: $0 {lock|logout|suspend|hibernate|reboot|shutdown}"
  38. exit 2
  39. esac
  40.  
  41. exit 0
Advertisement
Add Comment
Please, Sign In to add comment