diff --git a/pywal/wallpapermenu.sh b/pywal/wallpapermenu.sh index c5bba8b..a326e7b 100755 --- a/pywal/wallpapermenu.sh +++ b/pywal/wallpapermenu.sh @@ -2,22 +2,96 @@ FOLDER=~/Pictures/Wallpapers SCRIPT=~/scripts/pywal/pywal16.sh +export NSXIV_THUMBSIZE=1024 menu() { - CHOICE=$(nsxiv -otb $FOLDER/*) # nsxiv -o writes filename to stdout + # Use wofi to select wallpaper (text-based, no image preview) + # Since wofi doesn't support images, filenames are shown in a grid layout + CHOICE=$(ls "$FOLDER" | wofi --dmenu \ + --prompt "Select Wallpaper" \ + --width 1200 \ + --height 800 \ + --columns 3 \ + --insensitive) -case $CHOICE in - *.*) wal -i "$CHOICE" -o $SCRIPT - killall swaybg - swaybg -m fill -i "$CHOICE";; - *) exit 0 ;; -esac + # Exit if no selection made + [ -z "$CHOICE" ] && exit 0 + + # Construct full path + CHOICE="$FOLDER/$CHOICE" + + case $CHOICE in + *.*) wal -i "$CHOICE" -o "$SCRIPT" + killall swaybg 2>/dev/null + swaybg -m fill -i "$CHOICE" &;; + *) exit 0 ;; + esac } -case "$#" in - 0) menu;; - 1) wal -i "$CHOICE" -o "$SCRIPT";; - 2) wal -1 "$1" --theme $2 -o $SCRIPT ;; +# Alternative: Use nsxiv (best for image previews) +menu_nsxiv() { + CHOICE=$(nsxiv -otbg 1800x1200 "$FOLDER"/*) # nsxiv shows actual thumbnail previews + + [ -z "$CHOICE" ] && exit 0 + + case $CHOICE in + *.*) wal -i "$CHOICE" -o "$SCRIPT" + killall swaybg 2>/dev/null + swaybg -m fill -i "$CHOICE" &;; + *) exit 0 ;; + esac +} + +menu_rofi() { + # Use rofi with custom styling + CHOICE=$(find "$FOLDER" -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" \) -printf "%f\n" | \ + sort | \ + rofi -dmenu -i \ + -p "Select Wallpaper" \ + -theme-str 'window {width: 60%; height: 50%;}' \ + -theme-str 'listview {columns: 2; lines: 12;}' \ + -show-icons) + + [ -z "$CHOICE" ] && exit 0 + + # Construct full path + CHOICE="$FOLDER/$CHOICE" + + case $CHOICE in + *.*) wal -i "$CHOICE" -o "$SCRIPT" + killall swaybg 2>/dev/null + swaybg -m fill -i "$CHOICE" &;; + *) exit 0 ;; + esac +} + +menu_rofi_with_preview() { + # Rofi with image preview using external previewer + # This requires installing rofi-img-previewer or similar + CHOICE=$(find "$FOLDER" -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" \) -printf "%f\n" | \ + sort | \ + rofi -dmenu -i \ + -p "Select Wallpaper" \ + -theme-str 'window {width: 80%; height: 70%;}' \ + -theme-str 'listview {columns: 3; lines: 8;}') + + [ -z "$CHOICE" ] && exit 0 + + # Construct full path + CHOICE="$FOLDER/$CHOICE" + + case $CHOICE in + *.*) wal -i "$CHOICE" -o "$SCRIPT" + killall swaybg 2>/dev/null + swaybg -m fill -i "$CHOICE" &;; + *) exit 0 ;; + esac +} + +case "$#" in + 0) menu_nsxiv;; # Options: menu (wofi), menu_rofi (rofi), menu_nsxiv (nsxiv with thumbnails) + 1) wal -i "$1" -o "$SCRIPT";; + 2) wal -i "$1" --theme "$2" -o "$SCRIPT" ;; *) exit 0 ;; esac diff --git a/wallpapersync.sh b/wallpapersync.sh index 710d781..ced57d8 100755 --- a/wallpapersync.sh +++ b/wallpapersync.sh @@ -1,11 +1,11 @@ #!/usr/bin/env bash -Repo="~/Pictures/Wallpapers" -Dir_Wallpapers="~/Nextcloud/Mini-Arch/Wallpaper-Repo/" -Script_Resort="~/scripts/sort_images_by_color.py" +Repo="/home/nicholai/Pictures/Wallpapers" +Dir_Wallpapers="/home/nicholai/Nextcloud/Mini-Arch/Wallpaper-Repo/" +Script_Resort="/home/nicholai/scripts/sort_images_by_color.py" -# 1. Resort wallpapers -python "$Script_Resort" "$Dir_Wallpapers" +# 1. Resort wallpapers +"$(dirname "$0")/bin/python" "$Script_Resort" "$Dir_Wallpapers" # 3. sync new wallpapers in rsync -a --delete "$Dir_Wallpapers"/ "$Repo"/