Dotfiles/systemd/HOME/.config/systemd/user/randomBackground
2022-02-20 14:41:04 +00:00

25 lines
592 B
Bash
Executable file

#!/usr/bin/env bash
backgroundDir="$HOME/Pictures/wallpapers/"
background="$(ls "$backgroundDir" | /usr/bin/shuf -n 1 | /usr/bin/awk \
"{print \"$backgroundDir\" \$1}")"
echo "Wayland Display: $WAYLAND_DISPLAY"
if [ -n "$WAYLAND_DISPLAY" ]; then
while :; do
background="$(ls "$backgroundDir" | /usr/bin/shuf -n 1 | /usr/bin/awk \
"{print \"$backgroundDir\" \$1}")"
echo "I get here"
pkill swaybg
swaybg --mode fill -i "$background"
sleep 60
done
else
if [ -f /usr/bin/feh ]; then
/usr/bin/feh --bg-fill "$background"
else
/usr/bin/hsetroot -cover "$background"
fi
fi