diff options
-rw-r--r-- | .config/hypr/hyprland.conf | 1 | ||||
-rwxr-xr-x | .local/bin/hyprslideshow | 31 |
2 files changed, 32 insertions, 0 deletions
diff --git a/.config/hypr/hyprland.conf b/.config/hypr/hyprland.conf index 42b04ad..a53d5b6 100644 --- a/.config/hypr/hyprland.conf +++ b/.config/hypr/hyprland.conf @@ -9,6 +9,7 @@ exec-once=dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRE exec-once = pipewire & pipewire-pulse & wireplumber exec-once = start-portal exec-once = hyprpaper +exec-once = hyprslideshow /mnt/ssd/papes 60 exec-once = dunst exec-once = hypridle exec-once = gpg-agent --daemon diff --git a/.local/bin/hyprslideshow b/.local/bin/hyprslideshow new file mode 100755 index 0000000..0edcc74 --- /dev/null +++ b/.local/bin/hyprslideshow @@ -0,0 +1,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 |