Regenerated
This commit is contained in:
@@ -1,55 +0,0 @@
|
||||
#!/run/current-system/sw/bin/bash
|
||||
set -euo pipefail
|
||||
echo "Running as $(whoami)"
|
||||
|
||||
# -----------------------------
|
||||
# Configuration
|
||||
# -----------------------------
|
||||
PICTURES_DIR="$HOME/Wallpapers/pictures"
|
||||
NAMESPACE="main" # Base namespace for swww-daemon
|
||||
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
|
||||
|
||||
# -----------------------------
|
||||
# Pre-assign wallpapers to each workspace
|
||||
# -----------------------------
|
||||
declare -A WS_WALLPAPER
|
||||
for ws in $(hyprctl workspaces -j | jq -r '.[].id'); do
|
||||
RAND_IMAGE="${IMAGES[RANDOM % ${#IMAGES[@]}]}"
|
||||
WS_WALLPAPER["$ws"]="$RAND_IMAGE"
|
||||
echo "Pre-assigning wallpaper for workspace $ws: $RAND_IMAGE"
|
||||
swww img "$RAND_IMAGE" --resize stretch --transition-type random --namespace "$ws"
|
||||
done
|
||||
|
||||
# -----------------------------
|
||||
# Listen for workspace events
|
||||
# -----------------------------
|
||||
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]}"
|
||||
# Use the pre-assigned wallpaper for this workspace
|
||||
RAND_IMAGE="${WS_WALLPAPER[$WS]}"
|
||||
echo "Workspace $WS active → setting wallpaper: $RAND_IMAGE"
|
||||
swww img "$RAND_IMAGE" --resize stretch --transition-type random --namespace "$WS"
|
||||
fi
|
||||
done
|
||||
@@ -1,19 +1,23 @@
|
||||
#!/run/current-system/sw/bin/bash
|
||||
set -euo pipefail
|
||||
echo "Running as $(whoami)"
|
||||
currentuser=$(whoami) # or set manually
|
||||
currentprofile=/run/current-system/sw/bin
|
||||
|
||||
|
||||
# -----------------------------
|
||||
# Configuration
|
||||
# -----------------------------
|
||||
PICTURES_DIR="$HOME/Wallpapers/pictures"
|
||||
NAMESPACE="main" # Fixed swww namespace
|
||||
MONITOR=$(hyprctl monitors -j | jq -r '.[0].name') # First monitor
|
||||
MONITOR=$($currentprofile/hyprctl monitors -j | $currentprofile/jq -r '.[0].name')
|
||||
|
||||
# -----------------------------
|
||||
# Start swww-daemon if not running
|
||||
# -----------------------------
|
||||
if ! pgrep -x swww-daemon >/dev/null; then
|
||||
echo "Starting swww-daemon..."
|
||||
swww-daemon --namespace "$NAMESPACE" &
|
||||
$currentprofile/swww-daemon --namespace "$NAMESPACE" &
|
||||
sleep 0.5 # give socket time to appear
|
||||
fi
|
||||
|
||||
@@ -37,6 +41,6 @@ socat -u UNIX-CONNECT:"$IPC_SOCKET" STDOUT | while read -r line; do
|
||||
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"
|
||||
$currentprofile/swww img "$RAND_IMAGE" --resize stretch --transition-type random --namespace "$WS"
|
||||
fi
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user