summaryrefslogtreecommitdiff
path: root/pick_wall.sh
diff options
context:
space:
mode:
Diffstat (limited to 'pick_wall.sh')
-rwxr-xr-xpick_wall.sh21
1 files changed, 21 insertions, 0 deletions
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"