Created
August 9, 2013 16:22
-
-
Save attilaolah/6194984 to your computer and use it in GitHub Desktop.
Google Now wallpaper changer
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
#! /usr/bin/env sh | |
# Execute this file: | |
# - when logging in | |
# - from a cron job whet the day of time changes (see below) | |
# An improved version could probably get the location from | |
# the internet, and use that to figure out sunrise/sunset times. | |
# Select a random directory. | |
# Download Google Now wallpapers from: | |
# - http://brebenel-silviu.deviantart.com/art/Google-Now-353644327 | |
# - http://brebenel-silviu.deviantart.com/art/Google-Now-354098040 | |
# - http://brebenel-silviu.deviantart.com/art/Google-Now-364628160 | |
# - http://brebenel-silviu.deviantart.com/art/Google-Now-377029271 | |
# To keep using only one pack, download just that pack. | |
DIRS=("$PWD/Google Now "*) | |
GDIR="${DIRS[RANDOM % ${#DIRS[@]}]}" | |
# Figure out which to use based on the time of day. | |
# Change values 4, 7, 19 and 22 to match your local sunrise/sunset times. | |
hours=$(date +%H) | |
ok=$((hours<4)) | |
if [ $ok -eq 1 ] | |
then | |
feh --bg-scale "$GDIR/4.jpg" # night | |
exit | |
fi | |
ok=$((hours<7)) | |
if [ $ok -eq 1 ] | |
then | |
feh --bg-scale "$GDIR/1.jpg" # morning | |
exit | |
fi | |
ok=$((hours<19)) | |
if [ $ok -eq 1 ] | |
then | |
feh --bg-scale "$GDIR/2.jpg" # daytime | |
exit | |
fi | |
ok=$((hours<22)) | |
if [ $ok -eq 1 ] | |
then | |
feh --bg-scale "$GDIR/3.jpg" # evening | |
exit | |
fi | |
feh --bg-scale "$GDIR/4.jpg" # night |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment