Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
Ce dépôt est archivé. Vous pouvez voir les fichiers et le cloner, mais vous ne pouvez pas pousser ni ouvrir de ticket/demande d'ajout.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/bin/bash
  2. # Example locker script -- demonstrates how to use the --transfer-sleep-lock
  3. # option with i3lock's forking mode to delay sleep until the screen is locked.
  4. ## CONFIGURATION ##############################################################
  5. # Options to pass to i3lock
  6. i3lock_options="-c 330033 -f -p default"
  7. # Run before starting the locker
  8. pre_lock() {
  9. xset +dpms
  10. xset dpms 5 5 5
  11. xset s 5 5
  12. return
  13. }
  14. # Run after the locker exits
  15. post_lock() {
  16. /usr/local/bin/screensaver-enable
  17. return
  18. }
  19. ###############################################################################
  20. pre_lock
  21. # We set a trap to kill the locker if we get killed, then start the locker and
  22. # wait for it to exit. The waiting is not that straightforward when the locker
  23. # forks, so we use this polling only if we have a sleep lock to deal with.
  24. if [[ -e /dev/fd/${XSS_SLEEP_LOCK_FD:--1} ]]; then
  25. kill_i3lock() {
  26. pkill -xu $EUID "$@" i3lock
  27. }
  28. trap kill_i3lock TERM INT
  29. # we have to make sure the locker does not inherit a copy of the lock fd
  30. i3lock $i3lock_options {XSS_SLEEP_LOCK_FD}<&-
  31. # now close our fd (only remaining copy) to indicate we're ready to sleep
  32. exec {XSS_SLEEP_LOCK_FD}<&-
  33. while kill_i3lock -0; do
  34. sleep 0.5
  35. done
  36. else
  37. trap 'kill %%' TERM INT
  38. i3lock -n $i3lock_options &
  39. wait
  40. fi
  41. post_lock