Fix gif wallpapers rendering static instead of animated
omarchy-theme-set launches swaybg asynchronously in the background, which raced against the gif-detection logic and could leave a static swaybg frame on top of the animated awww daemon. Skip theme-set's own background step and own the daemon selection (swaybg vs awww) and symlink update directly, launch awww-daemon through uwsm-app like every other layer-shell client here, use awww's own graceful kill instead of a raw pkill to avoid a stale IPC socket, and log daemon output plus invocation env to ~/.cache for debugging. Claude-Session: https://claude.ai/code/session_011kf23kB9NsaczSYazZsWs6
This commit is contained in:
+34
-16
@@ -7,6 +7,14 @@ THEME_DIR="$HOME/.config/omarchy/themes/blob-dynamic"
|
|||||||
mkdir -p "$WALLPAPER_DIR"
|
mkdir -p "$WALLPAPER_DIR"
|
||||||
mkdir -p "$THEME_DIR/backgrounds"
|
mkdir -p "$THEME_DIR/backgrounds"
|
||||||
|
|
||||||
|
{
|
||||||
|
echo "=== $(date '+%F %T') invoked with: $* ==="
|
||||||
|
echo "WAYLAND_DISPLAY=$WAYLAND_DISPLAY"
|
||||||
|
echo "XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR"
|
||||||
|
echo "DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS"
|
||||||
|
echo "PATH=$PATH"
|
||||||
|
} >> "$HOME/.cache/blob-wallpaper.log"
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
# Open the AGS wallpaper selector widget
|
# Open the AGS wallpaper selector widget
|
||||||
ags toggle wall-picker
|
ags toggle wall-picker
|
||||||
@@ -77,27 +85,37 @@ return {
|
|||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Apply the Blob-Dynamic theme
|
# Apply the Blob-Dynamic theme, but skip its own background step: it
|
||||||
# omarchy-theme-set manages the background and reloads waybar and AGS
|
# launches swaybg asynchronously, which races with the gif handling
|
||||||
omarchy-theme-set "blob-dynamic"
|
# below and can leave a static swaybg frame on top of an animated gif.
|
||||||
|
OMARCHY_THEME_SKIP_BACKGROUND=1 omarchy-theme-set "blob-dynamic"
|
||||||
|
|
||||||
|
CURRENT_BACKGROUND_LINK="$HOME/.config/omarchy/current/background"
|
||||||
|
ln -nsf "$THEME_DIR/backgrounds/$(basename "$IMAGE_PATH")" "$CURRENT_BACKGROUND_LINK"
|
||||||
|
|
||||||
|
# Stop whichever daemon was previously rendering the background before
|
||||||
|
# starting the one this wallpaper needs. `awww kill` shuts the daemon down
|
||||||
|
# via its own IPC so it cleans up its socket, unlike a raw `pkill`.
|
||||||
|
pkill -x swaybg 2>/dev/null
|
||||||
|
awww kill --all >/dev/null 2>&1
|
||||||
|
pkill -x awww-daemon 2>/dev/null
|
||||||
|
|
||||||
# If it's a GIF, override swaybg with awww (swww replacement)
|
|
||||||
if [[ "${IMAGE_PATH,,}" == *.gif ]]; then
|
if [[ "${IMAGE_PATH,,}" == *.gif ]]; then
|
||||||
echo "GIF detected, switching to awww..."
|
echo "GIF detected, using awww for animation..."
|
||||||
pkill -x swaybg
|
setsid uwsm-app -- awww-daemon >>"$HOME/.cache/awww-daemon.log" 2>&1 &
|
||||||
|
|
||||||
# Start awww daemon if not running
|
# Poll until the daemon's IPC socket is ready instead of guessing a fixed sleep
|
||||||
if ! pgrep -x awww-daemon >/dev/null; then
|
IMG_ERROR=""
|
||||||
awww-daemon >/dev/null 2>&1 &
|
for _ in {1..15}; do
|
||||||
sleep 1
|
IMG_ERROR=$(awww img "$CURRENT_BACKGROUND_LINK" 2>&1) && break
|
||||||
|
sleep 0.3
|
||||||
|
done
|
||||||
|
if [[ -n "$IMG_ERROR" ]]; then
|
||||||
|
echo "awww failed to set the wallpaper: $IMG_ERROR"
|
||||||
|
echo "See $HOME/.cache/awww-daemon.log for daemon output."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
awww img "$IMAGE_PATH"
|
|
||||||
else
|
else
|
||||||
# Ensure awww is stopped for static wallpapers so swaybg can render them
|
setsid uwsm-app -- swaybg -i "$CURRENT_BACKGROUND_LINK" -m fill >/dev/null 2>&1 &
|
||||||
if pgrep -x awww-daemon >/dev/null; then
|
|
||||||
pkill -x awww-daemon
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Wallpaper and dynamic theme applied successfully: $IMAGE_PATH"
|
echo "Wallpaper and dynamic theme applied successfully: $IMAGE_PATH"
|
||||||
Reference in New Issue
Block a user