blob: 0edcc74f2237e25e6a4e24311e200e70d9949ffc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#!/bin/sh
if [ "$#" -ne 2 ]; then
echo "Use: $0 images_path timeout_sec"
exit
fi
IMG_PATH=$1
TIMEOUT=$2
until pids=$(pidof hyprpaper)
do
sleep 0.1
done
sleep 1
while true; do
hyprctl hyprpaper unload all
if ! pidof Hyprland > /dev/null; then rm $XDG_RUNTIME_DIR/wallpaper_wait.pid; exit; fi
new_wp=$(find ${IMG_PATH} -type f | shuf -n1)
hyprctl hyprpaper preload $new_wp
monitors_json=$(hyprctl monitors -j)
monitors_count=$(echo $monitors_json | jq length)
echo $monitors_count
for i in $(seq 0 $(($monitors_count-1))); do
monitor=$(echo $monitors_json | jq -r .[$i][\"name\"])
hyprctl hyprpaper wallpaper "$monitor,$new_wp"
done
sleep $TIMEOUT &
echo $! > $XDG_RUNTIME_DIR/wallpaper_wait.pid
waitpid $!
done
|