dot_testing/sh/wal

45 lines
768 B
Plaintext
Raw Normal View History

2021-02-15 12:02:09 -06:00
#!/bin/sh
2021-02-16 22:59:36 -06:00
WALLDIR="${HOME}/.local/share/wallpapers"
TEEFILE="${WALLDIR}/.hist"
2021-06-20 10:33:49 -05:00
BASECMD="feh --no-fehbg --bg-fill"
2021-02-15 12:02:09 -06:00
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