Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # https://stackoverflow.com/questions/36379612/starting-a-custom-screensaver-on-boot-behaves-differently-than-manually-starting
- # Requires:
- # - feh
- # - xprintidle
- # - xbindkeys
- # - cron
- # sudo apt-get install feh
- # sudo apt-get install xprintidle
- # sudo apt-get install xbindkeys
- # sudo apt-get install cron
- # crontab -e:
- # @reboot ./home/volumio/screensaver/start.sh
- # sudo mkdir screensaver
- # cd screensaver
- # sudo nano start.sh
- # copy/paste -> ctrl+x -> y
- # sudo chmod +x start.sh
- # reboot
- #Time in milliseconds
- IDLE_TIME=$((30*1000))
- #Path to photos
- PHOTO_FOLDER=/mnt/NAS/Cloud-Fotos
- # Sequence to execute when timeout triggers.
- trigger_cmd() {
- DISPLAY=:0 feh -ZXYrzFD 10 $PHOTO_FOLDER --zoom fill &
- echo '"pkill -n feh; pkill -n xbindkeys"'>/home/volumio/screensaver/xbindkeys.temp
- echo "b:1">>/home/volumio/screensaver/xbindkeys.temp #touch?
- DISPLAY=:0 xbindkeys -n -f /home/volumio/screensaver/xbindkeys.temp
- sudo rm /home/volumio/screensaver/xbindkeys.temp
- }
- # Wait for OS start
- sleep_time=60000
- while sleep $((sleep_time/1000)); do
- idle=$(DISPLAY=:0 xprintidle)
- if [ $idle -gt $IDLE_TIME ]; then
- trigger_cmd
- sleep_time=$IDLE_TIME
- else
- sleep_time=$((IDLE_TIME-idle))
- fi
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement