Skip to content

Instantly share code, notes, and snippets.

@tmplt
Created September 27, 2015 21:37
Show Gist options
  • Save tmplt/a908ba0496a422dd2fa9 to your computer and use it in GitHub Desktop.
Save tmplt/a908ba0496a422dd2fa9 to your computer and use it in GitHub Desktop.
bash script to get get random wallpapers on two screens every 45m
#!/bin/sh
WALLPATH_BIG=/home/tmplt/.wallpapers/big/
WALLPATH_SMALL=/home/tmplt/.wallpapers/small/
while true; do
# Choose a random wallpaper for the big screen
WP_BIG=$(find $WALLPATH_BIG -type f \( -name '*.jpg' -o -name '*.png' \) -print0 |
shuf -n1 -z)
# .. and the small screen,
WP_SMALL=$(find $WALLPATH_SMALL -type f \( -name '*.jpg' -o -name '*.png' \) -print0 |
shuf -n1 -z)
# My small screen is the first one from left to right.
feh --no-fehbg --bg-fill "${WP_SMALL}" --bg-fill "${WP_BIG}" > /dev/null 2>&1
# Throw away all output.
sleep 45m
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment