Last active
August 29, 2015 14:11
-
-
Save ravishi/f40aa653ad46a36d0edc to your computer and use it in GitHub Desktop.
Call this often to get a new wallpaper every day.
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 | |
# | |
# random-wallpaper.sh | |
# Call this often enough to get a new wallpaper every day. | |
# Where the wallpapers are located | |
WALLPAPERS=~/pictures/wallpapers/r-wallpapers | |
# Where the last change date will be saved | |
REGISTRY=~/.random-wallpaper | |
# The date format | |
DATEFORMAT=%Y-%m-%d | |
# The actual command | |
if [[ "`cat $REGISTRY 2> /dev/null`" != "`date +$DATEFORMAT`" ]]; then | |
wallpaper="`find $WALLPAPERS | grep -E '(\.png|\.jpe?g)' | shuf -n 1`" | |
gsettings set org.gnome.desktop.background picture-uri "file://$wallpaper" && date +$DATEFORMAT > $REGISTRY | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment