2021-02-15 12:02:09 -06:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
WALLDIR="${HOME}/.share/wallpapers"
|
2021-02-15 17:16:23 -06:00
|
|
|
TEEFILE="${WALLDIR}/hist"
|
2021-02-15 12:02:09 -06:00
|
|
|
BASECMD="feh --bg-fill"
|
|
|
|
|
|
|
|
generate_wall () {
|
|
|
|
GENWALL=$( \
|
|
|
|
ls $WALLDIR | \
|
2021-02-15 17:16:23 -06:00
|
|
|
grep "." | \
|
2021-02-15 12:02:09 -06:00
|
|
|
shuf -n 1
|
|
|
|
)
|
|
|
|
GENWALL="${WALLDIR}/${GENWALL}"
|
|
|
|
}
|
|
|
|
wall () {
|
|
|
|
generate_wall
|
|
|
|
while [ "${GENWALL}" = "${1}" ]; do
|
|
|
|
generate_wall
|
|
|
|
done
|
|
|
|
}
|
|
|
|
displays () {
|
|
|
|
displays=$(xrandr | grep ' connected' | wc -l)
|
|
|
|
}
|
|
|
|
check () {
|
|
|
|
which $1 &>/dev/null
|
|
|
|
}
|
|
|
|
|
|
|
|
cmd=""
|
|
|
|
check "feh" || exit 1
|
|
|
|
if check "xrandr"; then
|
|
|
|
displays
|
|
|
|
for i in $(seq 1 $displays); do
|
|
|
|
wall ${tmp}
|
|
|
|
tmp=${GENWALL}
|
2021-02-15 17:16:23 -06:00
|
|
|
echo ${GENWALL} ${i} | tee $TEEFILE
|
2021-02-15 12:02:09 -06:00
|
|
|
cmd="${cmd} ${GENWALL}"
|
|
|
|
done
|
|
|
|
eval ${BASECMD} ${cmd}
|
|
|
|
else
|
|
|
|
generate_wall
|
|
|
|
eval ${BASECMD} ${GENWALL}
|
|
|
|
fi
|
|
|
|
unset GENWALL BASECMD tmp cmd displays i
|
|
|
|
exit 0
|