您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
此仓库已存档。您可以查看文件和克隆,但不能推送或创建工单/合并请求。

mate-screensaver.sh.j2 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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