Skip to content

Instantly share code, notes, and snippets.

@LordAro
Created April 23, 2016 15:15
Show Gist options
  • Save LordAro/2cb1d8ad3786a2d80e7a48bad8e98bed to your computer and use it in GitHub Desktop.
Save LordAro/2cb1d8ad3786a2d80e7a48bad8e98bed to your computer and use it in GitHub Desktop.
#!/usr/bin/env sh
WALL_DIR=${HOME}/Pictures/Backgrounds
PORTRAIT=""
LANDSCAPE=""
for i in ${WALL_DIR}/*; do
set -- $(identify -ping -format "%w %h" "$i")
if [ "$2" -lt "$1" ]; then
LANDSCAPE+="$i "
else
PORTRAIT+="$i "
fi
done
PORTL=$(echo ${PORTRAIT} | tr ' ' '\n' | shuf -n1)
LAND=$(echo ${LANDSCAPE} | tr ' ' '\n' | shuf -n1)
PORTR=$(echo ${PORTRAIT} | tr ' ' '\n' | shuf -n1)
feh --no-fehbg --bg-fill $LAND $PORTR $PORTL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment