stop slideshow when changing bg

This commit is contained in:
andrzej 2024-10-11 19:21:41 +02:00
parent 50e001f085
commit 383c8dc7af
3 changed files with 32 additions and 2 deletions

View File

@ -0,0 +1 @@
11599

View File

@ -1,4 +1,24 @@
#!/usr/bin/env bash
PIDFILE=bg_slideshow.pid
remove_pidfile()
{
rm -f "$PIDFILE"
}
if [ -f "$PIDFILE" ]; then
kill -9 "$(cat $PIDFILE)"
fi
if [[ ${1} == kill ]]; then
echo "killing myslef, byeeee"
exit
fi
echo $$ > "$PIDFILE"
bgsDirectory="/home/andrzej/bgs/"
path=${1}
duration=${2}
@ -24,10 +44,12 @@ randomIndex=$(($RANDOM % $length))
echo ${image}
}
while true; do
chooseRandom ${path}
hyprctl hyprpaper preload "${image}"
hyprctl hyprpaper wallpaper ",${image}"
hyprctl hyprpaper wallpaper ",contain:${image}"
sleep $duration
hyprpaper unload all
done

View File

@ -1,11 +1,18 @@
bgsDirectory="${HOME}/bgs/"
##set working directory to location of this script
cd "$(dirname "$0")"
##stop slideshow if running
sh ./hyprland-slideshow.sh kill
preloadImage(){
hyprctl hyprpaper preload "${image}"
}
setImage() {
hyprctl hyprpaper wallpaper ",${image}"
hyprctl hyprpaper wallpaper ",contain:${image}"
}
#ARGS $1:directory e.g. chsck