diff --git a/install.sh b/install.sh index e61ec21..2b2320d 100755 --- a/install.sh +++ b/install.sh @@ -104,6 +104,9 @@ install_dependencies() { if ! command -v magick &> /dev/null && ! command -v convert &> /dev/null; then deps_needed+=("imagemagick") fi + if ! command -v awww &> /dev/null; then + deps_needed+=("awww") + fi if [ ${#deps_needed[@]} -gt 0 ]; then echo "Installing missing dependencies: ${deps_needed[*]}" diff --git a/scripts/blob_wallpaper.sh b/scripts/blob_wallpaper.sh index c404cf8..066940e 100755 --- a/scripts/blob_wallpaper.sh +++ b/scripts/blob_wallpaper.sh @@ -8,31 +8,14 @@ mkdir -p "$WALLPAPER_DIR" mkdir -p "$THEME_DIR/backgrounds" 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 - mapfile -t files < <(ls -1 "$WALLPAPER_DIR" 2>/dev/null) - - if [ ${#files[@]} -eq 0 ]; then - echo "No wallpapers found." - exit 1 + if [ -z "$SELECTED_FILE" ]; then + echo "No wallpaper selected." + exit 0 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") else # 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 "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" \ No newline at end of file