]> git.draconx.ca Git - fvwmconf.git/blobdiff - scripts/bgmenu.zsh
Fix scripts/bgmenu.sh to use both zsh and the aspect tool.
[fvwmconf.git] / scripts / bgmenu.zsh
diff --git a/scripts/bgmenu.zsh b/scripts/bgmenu.zsh
new file mode 100755 (executable)
index 0000000..7c0b7d4
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/zsh
+# Generates an FVWM menu for selecting the PNG images found in a given
+# directory.  Thumbnails for the images are generated on the fly using convert
+# from ImageMagick, and stored in the .thumbs subdirectory.  The menu items
+# run the specified function with the filename as the first argument.
+
+menu="MenuWallpaper"
+func="SetWallpaper"
+thumber="$FVWM_USERDIR/scripts/thumbnail.sh"
+
+if [ ! -d "$1" ]; then
+       echo "usage: $0 <directory> [menuname]" 1>&2
+       exit 1
+fi
+[ -n "$2" ] && menu="$2"
+
+for i in "$1"/*$($FVWM_USERDIR/scripts/C/xaspect).png; do
+       thumb="`$thumber --size x160 "$i"`"
+       echo "AddToMenu $menu \"`basename "${i%.png}"`*$thumb*\" $func \"$i\""
+done