From 7c7ca768a7d90871eeb25a98fb7fb4309e5bb3bd Mon Sep 17 00:00:00 2001 From: hmj6502 Date: Sun, 28 Dec 2025 20:46:29 +0000 Subject: add pick_wall.sh (dmenu wallpaper picker) --- README.md | 15 +++++++++------ pick_wall.sh | 21 +++++++++++++++++++++ 2 files changed, 30 insertions(+), 6 deletions(-) create mode 100755 pick_wall.sh diff --git a/README.md b/README.md index 8ac6fcb..d7d43a7 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,15 @@ * make wallpapers based on album covers! -takes most promiment color in album cover, centres cover and sets it as -wallpaper. +centres album cover as wallpaper with solid colour background (the most +promiment colour in the cover) + +* wallpaper picker! +uses dmenu to let you pick any image from $IMG_DIR + +includes random wallpaper choice :D * dependencies - X11 - xwallpaper -- colors (https://git.2f30.org/colors/) +- dmenu +- colors (https://git.2f30.org/colors/) (included as submodule) - imagemagick - -* TODO -- add dmenu selector of image names 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