]> git.draconx.ca Git - fvwmconf.git/blob - scripts/bgmenu.sh
ec6ae8f050dbc21f57551b2404be80041a5f8921
[fvwmconf.git] / scripts / bgmenu.sh
1 #!/bin/sh
2 # Generates an FVWM menu for selecting the PNG images found in a given
3 # directory.  Thumbnails for the images are generated on the fly using convert
4 # from ImageMagick, and stored in the .thumbs subdirectory.  The menu items
5 # run the specified function with the filename as the first argument.
6
7 menu="MenuWallpaper"
8 func="SetWallpaper"
9 thumber="$HOME/.fvwm/scripts/thumbnail.sh"
10
11 if [ ! -d "$1" ]; then
12         echo "usage: $0 <directory> [menuname]" 1>&2
13         exit 1
14 fi
15 [ -n "$2" ] && menu="$2"
16
17 for i in "$1"/*.png; do
18         thumb="`$thumber --size x160 "$i"`"
19         echo "AddToMenu $menu \"`basename "${i%.png}"`*$thumb*\" $func \"$i\""
20 done