summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhmj6502 <hashim@hmj6502.com>2025-12-28 20:46:29 +0000
committerhmj6502 <hashim@hmj6502.com>2025-12-28 20:46:29 +0000
commit7c7ca768a7d90871eeb25a98fb7fb4309e5bb3bd (patch)
treeef5cd59aa8a06fe8b4e42c76cd0aaa7a6ae6ac88
parent968935e00f3dca2d0b64ca7eaf1b411c9ad1a344 (diff)
downloadalbum-wall-7c7ca768a7d90871eeb25a98fb7fb4309e5bb3bd.tar.gz
album-wall-7c7ca768a7d90871eeb25a98fb7fb4309e5bb3bd.tar.bz2
album-wall-7c7ca768a7d90871eeb25a98fb7fb4309e5bb3bd.zip
add pick_wall.sh (dmenu wallpaper picker)
-rw-r--r--README.md15
-rwxr-xr-xpick_wall.sh21
2 files changed, 30 insertions, 6 deletions
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"