Last active
December 29, 2015 14:39
-
-
Save shouya/7685273 to your computer and use it in GitHub Desktop.
Automatically change wallpaper randomly every X minutes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export HOME=/home/shou | |
export BG_DIR="$HOME/Pictures/Anime/wallpapers" | |
export DISPLAY=':0' | |
rand_bg() { | |
find "$BG_DIR" -iname "*.jpg" -o -iname "*.png" | shuf | head -n1 | |
} | |
set_bg() { | |
read bg_file | |
feh --bg-fill "$bg_file" | |
echo "$bg_file" | |
} | |
if [ -t 0 -o "$1" = "startup" ]; then | |
rand_bg | set_bg | |
else | |
set_bg | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*/20 * * * * root test -x /home/shou/scripts/auto_set_bg.sh && /home/shou/scripts/auto_set_bg.sh startup |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment