# Backgroundmenu addbackground() { picturename=`basename "$1"` append "[exec] (${picturename%.???}) {fbsetbg -a \"$1\" }" } if [ "$BACKGROUNDMENUITEM" = yes ]; then IFS=: # set delimetor for find NUMBER_OF_BACKGROUNDS=`find $BACKGROUND_DIRS -follow -type f 2> /dev/null|wc -l` if [ "$NUMBER_OF_BACKGROUNDS" -gt 0 ]; then append_menu "[submenu] (${BACKGROUNDMENU}) {${BACKGROUNDMENUTITLE}}" append "[exec] (${RANDOMBACKGROUND}) {fbsetbg -r ${HOME}/.fluxbox/backgrounds}" if [ "$NUMBER_OF_BACKGROUNDS" -gt 30 ]; then menucounter=1 ; counter=1 append_menu "[submenu] (${BACKGROUNDMENU} $menucounter) {${BACKGROUNDMENUTITLE}}" find $BACKGROUND_DIRS -follow -type f|sort|while read i; do counter=`expr $counter + 1` if [ $counter -eq 30 ]; then counter=1 menucounter=`expr $menucounter + 1` append_menu_end append_menu "[submenu] (${BACKGROUNDMENU} $menucounter) {${BACKGROUNDMENUTITLE}}" fi addbackground "$i" done append_menu_end else find $BACKGROUND_DIRS -follow -type f|sort|while read i; do addbackground "$i" done fi append_menu_end else echo "Warning: You wanted a background-menu but I couldn't find any backgrounds in: $BACKGROUND_DIRS" >&2 fi fi