i3-lock 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/sh
  2. if [[ $# -eq 0 ]] ; then
  3. echo "i3-lock [ enable | disable | suspend | lock | start ]"
  4. exit
  5. fi
  6. case ${1} in
  7. locker-command)
  8. i3lock -c 536a77 -e -f -n
  9. ;;
  10. locker-command-fork)
  11. i3lock -c 536a77 -e -f
  12. ;;
  13. lock)
  14. xidlehook-client --socket ~/.xidlehook.sock \
  15. control --action trigger --timer 0
  16. ;;
  17. start)
  18. rm ~/.xidlehook.sock
  19. xidlehook --socket ~/.xidlehook.sock \
  20. --not-when-fullscreen \
  21. --not-when-audio \
  22. --timer 300 "i3-lock locker-command" ""
  23. ;;
  24. disable)
  25. xidlehook-client --socket ~/.xidlehook.sock \
  26. control --action disable --timer 0
  27. ;;
  28. enable)
  29. xidlehook-client --socket ~/.xidlehook.sock \
  30. controll --action enable --timer 0
  31. ;;
  32. suspend)
  33. ssh-add -D
  34. i3-lock lock
  35. sleep 1
  36. systemctl suspend
  37. ;;
  38. hibernate)
  39. ssh-add -D
  40. i3-lock lock
  41. sleep 1
  42. systemctl hibernate
  43. ;;
  44. *)
  45. echo "i3-lock [ enable | disable | lock | start ]"
  46. esac