No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
Este repositorio está archivado. Puede ver los archivos y clonarlo, pero no puede subir cambios o reportar incidencias ni pedir Pull Requests.

49 líneas
1.1KB

  1. #!/bin/bash
  2. # Example locker script -- demonstrates how to use the --transfer-sleep-lock
  3. # option with a fixed delay to give simple lockers a little bit of time to lock
  4. # the screen before the system goes the sleep.
  5. ## CONFIGURATION ##############################################################
  6. # Command to start the locker (should not fork)
  7. locker="mate-screensaver-command -l"
  8. # Delay in seconds. Note that by default systemd-logind allows a maximum sleep
  9. # delay of 5 seconds.
  10. sleep_delay=1
  11. # Run before starting the locker
  12. pre_lock() {
  13. #mpc pause
  14. return
  15. }
  16. # Run after the locker exits
  17. post_lock() {
  18. return
  19. }
  20. ###############################################################################
  21. pre_lock
  22. # kill locker if we get killed
  23. trap 'kill %%' TERM INT
  24. if [[ -e /dev/fd/${XSS_SLEEP_LOCK_FD:--1} ]]; then
  25. # lock fd is open, make sure the locker does not inherit a copy
  26. $locker {XSS_SLEEP_LOCK_FD}<&- &
  27. sleep $sleep_delay
  28. # now close our fd (only remaining copy) to indicate we're ready to sleep
  29. exec {XSS_SLEEP_LOCK_FD}<&-
  30. else
  31. $locker &
  32. fi
  33. wait # for locker to exit
  34. post_lock