Regenerated
This commit is contained in:
@@ -2,22 +2,26 @@
|
||||
set -euo pipefail
|
||||
echo "Running as $(whoami)"
|
||||
currentuser=$(whoami) # or set manually
|
||||
currentprofile=/run/current-system/sw/bin
|
||||
currentpath=/run/current-system/sw/bin
|
||||
|
||||
while [ ! -S "$IPC_SOCKET" ]; do
|
||||
echo "Waiting for Hyprland socket..."
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# -----------------------------
|
||||
# Configuration
|
||||
# -----------------------------
|
||||
PICTURES_DIR="$HOME/Wallpapers/pictures"
|
||||
NAMESPACE="main" # Fixed swww namespace
|
||||
MONITOR=$($currentprofile/hyprctl monitors -j | $currentprofile/jq -r '.[0].name')
|
||||
MONITOR=$($currentpath/hyprctl monitors -j | $currentpath/jq -r '.[0].name')
|
||||
|
||||
# -----------------------------
|
||||
# Start swww-daemon if not running
|
||||
# -----------------------------
|
||||
if ! pgrep -x swww-daemon >/dev/null; then
|
||||
if ! pgrep -x $currentpath/swww-daemon >/dev/null; then
|
||||
echo "Starting swww-daemon..."
|
||||
$currentprofile/swww-daemon --namespace "$NAMESPACE" &
|
||||
$currentpath/swww-daemon --namespace "$NAMESPACE" &
|
||||
sleep 0.5 # give socket time to appear
|
||||
fi
|
||||
|
||||
@@ -36,11 +40,11 @@ fi
|
||||
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
|
||||
$currentpath/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"
|
||||
$currentprofile/swww img "$RAND_IMAGE" --resize stretch --transition-type random --namespace "$WS"
|
||||
$currentpath/swww img "$RAND_IMAGE" --resize stretch --transition-type random --namespace "$WS"
|
||||
fi
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user