Skip to content

Instantly share code, notes, and snippets.

@LordAro
Created October 15, 2016 12:25
Show Gist options
  • Save LordAro/6849b98d9329a41f58cc2b8f091acd59 to your computer and use it in GitHub Desktop.
Save LordAro/6849b98d9329a41f58cc2b8f091acd59 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