wallpaper-changer systemd service - working

This commit is contained in:
Sam 2024-05-12 12:36:41 +01:00
parent be4163dcd4
commit acb21454c0
1 changed files with 0 additions and 26 deletions

View File

@ -1,26 +0,0 @@
set +o errexit
set +o nounset
set +o pipefail
script_name=${BASH_SOURCE[0]}
for pid in $(pidof -x "$script_name"); do
if [ "$pid" != $$ ]; then
kill -15 "$pid"
fi
done
[ "$XDG_SESSION_TYPE" != "wayland" ] && echo "Not a Wayland session, exiting." && exit 1
wallpaper_dir="$HOME/.local/share/bg/"
swww_daemon_pid=$(pidof -x 'swww-daemon')
swww_pid=$(pidof -x 'swww')
[ -z "$swww_daemon_pid" ] || kill -15 "$swww_daemon_pid"
[ -z "$swww_pid" ] || kill -15 "$swww_pid"
swww-daemon &
while true; do
find "$wallpaper_dir" -type f -follow \( -iname \*.jpg -o -iname \*.png -o -iname \*.gif -o -iname \*.bmp \) | shuf | while read -r file; do
swww img "$file" --transition-step 10 --transition-fps 60
sleep 600
done
done