From 48a85bd5c81cffac9e9ff725113fb9b933c04dae Mon Sep 17 00:00:00 2001 From: hmjsp Date: Sun, 28 Dec 2025 20:46:29 +0000 Subject: add pick_wall.sh (dmenu wallpaper picker) --- pick_wall.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 pick_wall.sh (limited to 'pick_wall.sh') diff --git a/pick_wall.sh b/pick_wall.sh new file mode 100755 index 0000000..1e90c6c --- /dev/null +++ b/pick_wall.sh @@ -0,0 +1,21 @@ +#!/bin/sh +LINES=16 +# width of menu is a third of the screen; use that to centre X and use number +# of lines to centre Y +Z=$(echo "$(xrandr --current | grep '*' | awk '{print $1}' | cut -d 'x' -f1)/3" | bc) +X=$(echo "($(xrandr --current | grep '*' | awk '{print $1}' | cut -d 'x' -f1)-$Z)/2" | bc) +Y=$(echo "$(xrandr --current | grep '*' | awk '{print $1}' | cut -d 'x' -f2)/2-(8*$LINES)" | bc) + +if [ $# -eq 0 ]; then + IMG_DIR="$HOME/Pictures/albums/" +else + IMG_DIR="$1" +fi + +# remove directory prefix from list +ALBUM="$(find "$IMG_DIR" -not -path '*/.*' -type f -printf "%p\n" | + sed "s:$IMG_DIR::" | sort | dmenu -i -l $LINES -x $X -y $Y -z $Z -p "album?")" +# replace prefix so correct path passed +ALBUM="$(printf "%s/%s" "$IMG_DIR" "$ALBUM")" + +wall_gen.sh "$ALBUM" -- cgit v1.2.3