Integrate GUI wallpaper selector and animated GIF support via awww

This commit is contained in:
2026-04-20 20:02:05 -04:00
parent b2717d88e8
commit bfa9ed67f7
2 changed files with 27 additions and 22 deletions
+3
View File
@@ -104,6 +104,9 @@ install_dependencies() {
if ! command -v magick &> /dev/null && ! command -v convert &> /dev/null; then if ! command -v magick &> /dev/null && ! command -v convert &> /dev/null; then
deps_needed+=("imagemagick") deps_needed+=("imagemagick")
fi fi
if ! command -v awww &> /dev/null; then
deps_needed+=("awww")
fi
if [ ${#deps_needed[@]} -gt 0 ]; then if [ ${#deps_needed[@]} -gt 0 ]; then
echo "Installing missing dependencies: ${deps_needed[*]}" echo "Installing missing dependencies: ${deps_needed[*]}"
+24 -22
View File
@@ -8,31 +8,14 @@ mkdir -p "$WALLPAPER_DIR"
mkdir -p "$THEME_DIR/backgrounds" mkdir -p "$THEME_DIR/backgrounds"
if [ -z "$1" ]; then if [ -z "$1" ]; then
echo "Available wallpapers in $WALLPAPER_DIR:" # Use walker dmenu for GUI selection
SELECTED_FILE=$(ls -1 "$WALLPAPER_DIR" 2>/dev/null | omarchy-launch-walker --dmenu -p "Select Wallpaper")
# Read files into an array if [ -z "$SELECTED_FILE" ]; then
mapfile -t files < <(ls -1 "$WALLPAPER_DIR" 2>/dev/null) echo "No wallpaper selected."
exit 0
if [ ${#files[@]} -eq 0 ]; then
echo "No wallpapers found."
exit 1
fi fi
# Print the menu
for i in "${!files[@]}"; do
printf "%3d. %s\n" "$((i+1))" "${files[$i]}"
done
echo ""
read -p "Select a wallpaper number (1-${#files[@]}): " selection
# Validate selection
if ! [[ "$selection" =~ ^[0-9]+$ ]] || [ "$selection" -lt 1 ] || [ "$selection" -gt "${#files[@]}" ]; then
echo "Invalid selection."
exit 1
fi
SELECTED_FILE="${files[$((selection-1))]}"
IMAGE_PATH=$(realpath "$WALLPAPER_DIR/$SELECTED_FILE") IMAGE_PATH=$(realpath "$WALLPAPER_DIR/$SELECTED_FILE")
else else
# Check if the argument is a file in the wallpapers directory # Check if the argument is a file in the wallpapers directory
@@ -88,4 +71,23 @@ EOF
# omarchy-theme-set manages the background and reloads waybar and AGS # omarchy-theme-set manages the background and reloads waybar and AGS
omarchy-theme-set "blob-dynamic" omarchy-theme-set "blob-dynamic"
# If it's a GIF, override swaybg with awww (swww replacement)
if [[ "${IMAGE_PATH,,}" == *.gif ]]; then
echo "GIF detected, switching to awww..."
pkill -x swaybg
# Start awww daemon if not running
if ! pgrep -x awww-daemon >/dev/null; then
awww-daemon >/dev/null 2>&1 &
sleep 1
fi
awww img "$IMAGE_PATH"
else
# Ensure awww is stopped for static wallpapers so swaybg can render them
if pgrep -x awww-daemon >/dev/null; then
pkill -x awww-daemon
fi
fi
echo "Wallpaper and dynamic theme applied successfully: $IMAGE_PATH" echo "Wallpaper and dynamic theme applied successfully: $IMAGE_PATH"