From 7625ce340a14fa8e6faf8f01619a01ba0a61ca2f Mon Sep 17 00:00:00 2001 From: krolxon Date: Mon, 20 Oct 2025 16:01:47 +0530 Subject: [PATCH] setwall: add -n parameter, useful to just set previous wallpaper as it is --- .local/bin/setwall | 53 +++++++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 19 deletions(-) diff --git a/.local/bin/setwall b/.local/bin/setwall index 178b233..173faf3 100755 --- a/.local/bin/setwall +++ b/.local/bin/setwall @@ -3,12 +3,36 @@ WALL_DIR="$HOME/pix/wallpapers/catppuccin/" MODE="random" CUSTOM_PATH="" +apply_wallpaper() { + # Apply wallpaper + if ! pgrep -x hyprpaper >/dev/null; then + # Hyprpaper not running → start with chosen wallpaper + cat > ~/.config/hypr/hyprpaper.conf < ~/.config/hypr/hyprpaper.conf <&2; exit 1 ;; + p) MODE="path"; CUSTOM_PATH="$(realpath $OPTARG)" ;; + n) MODE="nc" ;; + \?) echo "Usage: $0 [-m] [-p /path/to/image] [-n]" >&2; exit 1 ;; :) echo "Option -$OPTARG requires an argument." >&2; exit 1 ;; esac done @@ -17,6 +41,7 @@ done case $MODE in random) NEW_WALL=$(find "$WALL_DIR" -type f | shuf -n 1) + apply_wallpaper ;; path) if [[ -f "$CUSTOM_PATH" ]]; then @@ -25,24 +50,14 @@ case $MODE in echo "Error: File not found -> $CUSTOM_PATH" >&2 exit 1 fi + apply_wallpaper ;; menu) NEW_WALL=$(nsxiv -tfpo $WALL_DIR) + apply_wallpaper + ;; + nc) + echo "Not changing anything" + pgrep 'hyprpaper' || hyprpaper & ;; esac - -# Apply wallpaper -if ! pgrep -x hyprpaper >/dev/null; then - # Hyprpaper not running → start with chosen wallpaper - cat > ~/.config/hypr/hyprpaper.conf <