summaryrefslogtreecommitdiff
path: root/.config
diff options
context:
space:
mode:
authorsilly <u65487754@gmail.com>2026-03-16 10:11:54 +0100
committerGitHub <noreply@github.com>2026-03-16 10:11:54 +0100
commit0fd9f009e58e36afa79bfe5205123fe75c9712ca (patch)
treeb46679f5ade5c6c84e6b7c75101341c55bf2e277 /.config
parentbd28ae491f79252a8e050b4198114b24db0a9cd0 (diff)
Update wallpaper.sh
Diffstat (limited to '.config')
-rw-r--r--.config/scripts/wallpaper.sh38
1 files changed, 28 insertions, 10 deletions
diff --git a/.config/scripts/wallpaper.sh b/.config/scripts/wallpaper.sh
index 7d0caed..40520ca 100644
--- a/.config/scripts/wallpaper.sh
+++ b/.config/scripts/wallpaper.sh
@@ -1,32 +1,50 @@
#!/bin/bash
-WALL_DIR="$HOME/.config/wallpaper/"
-CACHE_PATH="$HOME/.cache/wallpaper.*"
+WALLPAPER_DIR="$HOME/.config/wallpaper/"
+THUMBNAIL_DIR="$HOME/.cache/wallpaper_thumbnails/"
+CACHE_PATH="$HOME/.cache/wallpaper.img"
+RASI_THEME="$HOME/.config/rofi/wallpaper.rasi"
MAIN_MONITOR="HDMI-A-1"
SECOND_MONITOR="DP-1"
-selected=$(echo -e "random\n$(ls "$WALL_DIR")" | fuzzel -d -p "> ")
+mkdir -p "$THUMBNAIL_DIR"
+list_images() {
+ DICE_ICON="$HOME/.config/rofi/dice.png"
+ echo -en "random\0icon\x1f$DICE_ICON\n"
+
+ for img in "$WALLPAPER_DIR"*; do
+ filename=$(basename "$img")
+ thumb="$THUMBNAIL_DIR$filename"
+
+ if [ ! -f "$thumb" ]; then
+ convert "$img" -thumbnail 300x "$thumb" &
+ fi
+
+ echo -en "$filename\0icon\x1f$thumb\n"
+ done
+ wait
+}
+
+selected=$(list_images | rofi -dmenu -i -p ">" -theme "$RASI_THEME")
[[ -z "$selected" ]] && exit
-if [ "$selected" = "random" ]; then
- wall=$(basename "$(readlink -f "$CACHE_PATH")")
- selected=$(ls "$WALL_DIR" | grep -v "$wall" | shuf -n 1)
+if [[ "$selected" == "random" ]]; then
+ current_wall=$(basename "$(readlink -f "$CACHE_PATH")" 2>/dev/null)
+ selected=$(ls "$WALLPAPER_DIR" | grep -v "$current_wall" | shuf -n 1)
fi
-FULL_PATH="$WALL_DIR/$selected"
+FULL_PATH="$WALLPAPER_DIR/$selected"
swww img -o "$MAIN_MONITOR" "$FULL_PATH" --transition-type grow --transition-duration 1.5 --transition-fps 120
swww clear --outputs "$SECOND_MONITOR"
wal -i "$FULL_PATH" -n -q
-
ln -sf "$FULL_PATH" "$CACHE_PATH"
kill -SIGUSR1 $(pgrep kitty) 2>/dev/null
-
killall dunst
dunst &
sleep 0.1
-notify-send "theme" "updated from $selected"
+notify-send "theme" "updated"