Advertisement
Harton

Slideshow

Jun 30th, 2020
222
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.28 KB | None | 1 0
  1. #!/bin/sh
  2.  
  3. # https://stackoverflow.com/questions/36379612/starting-a-custom-screensaver-on-boot-behaves-differently-than-manually-starting
  4. # Requires:
  5. #  - feh
  6. #  - xprintidle
  7. #  - xbindkeys
  8. #  - cron
  9.  
  10. # sudo apt-get install feh
  11. # sudo apt-get install xprintidle
  12. # sudo apt-get install xbindkeys
  13. # sudo apt-get install cron
  14. # crontab -e:
  15. #   @reboot ./home/volumio/screensaver/start.sh
  16. # sudo mkdir screensaver
  17. # cd screensaver
  18. # sudo nano start.sh
  19. # copy/paste -> ctrl+x -> y
  20. # sudo chmod +x start.sh
  21. # reboot
  22.  
  23. #Time in milliseconds
  24. IDLE_TIME=$((30*1000))
  25. #Path to photos
  26. PHOTO_FOLDER=/mnt/NAS/Cloud-Fotos
  27.  
  28. # Sequence to execute when timeout triggers.
  29. trigger_cmd() {
  30. DISPLAY=:0 feh -ZXYrzFD 10 $PHOTO_FOLDER --zoom fill &
  31.     echo '"pkill -n feh; pkill -n xbindkeys"'>/home/volumio/screensaver/xbindkeys.temp
  32.     echo "b:1">>/home/volumio/screensaver/xbindkeys.temp #touch?
  33.     DISPLAY=:0 xbindkeys -n -f /home/volumio/screensaver/xbindkeys.temp
  34.     sudo rm /home/volumio/screensaver/xbindkeys.temp
  35. }
  36.  
  37. # Wait for OS start
  38. sleep_time=60000
  39. while sleep $((sleep_time/1000)); do
  40.     idle=$(DISPLAY=:0 xprintidle)
  41.     if [ $idle -gt $IDLE_TIME ]; then
  42.         trigger_cmd
  43.         sleep_time=$IDLE_TIME
  44.     else
  45.         sleep_time=$((IDLE_TIME-idle))
  46.     fi
  47. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement