Regenerated

This commit is contained in:
2026-03-29 15:48:40 +00:00
parent cc3c959216
commit cb4de602cb
9 changed files with 438 additions and 355 deletions
@@ -0,0 +1,42 @@
#!/usr/bin/env bash
set -euo pipefail
# -----------------------------
# Configuration
# -----------------------------
PICTURES_DIR="$HOME/Wallpapers/pictures"
NAMESPACE="main" # Fixed swww namespace
MONITOR=$(hyprctl monitors -j | jq -r '.[0].name') # First monitor
# -----------------------------
# Start swww-daemon if not running
# -----------------------------
if ! pgrep -x swww-daemon >/dev/null; then
echo "Starting swww-daemon..."
swww-daemon --namespace "$NAMESPACE" &
sleep 0.5 # give socket time to appear
fi
# -----------------------------
# Gather wallpapers
# -----------------------------
mapfile -t IMAGES < <(find "$PICTURES_DIR" -type f \( -iname '*.png' -o -iname '*.jpg' -o -iname '*.jpeg' \))
if [ "${#IMAGES[@]}" -eq 0 ]; then
echo "No images found in $PICTURES_DIR"
exit 1
fi
# -----------------------------
# Workspace event listener
# -----------------------------
IPC_SOCKET="$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock"
echo "Listening for workspace events on $IPC_SOCKET..."
socat -u UNIX-CONNECT:"$IPC_SOCKET" STDOUT | while read -r line; do
if [[ "$line" =~ workspace\#([0-9]+) ]]; then
WS="${BASH_REMATCH[1]}"
RAND_IMAGE="${IMAGES[RANDOM % ${#IMAGES[@]}]}"
echo "Workspace $WS active → setting wallpaper: $RAND_IMAGE"
swww img "$RAND_IMAGE" --resize stretch --transition-type random --namespace "$WS"
fi
done