summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xutil/fluxbox-generate_menu.in42
1 files changed, 20 insertions, 22 deletions
diff --git a/util/fluxbox-generate_menu.in b/util/fluxbox-generate_menu.in
index dbd6cb0..3e3d564 100755
--- a/util/fluxbox-generate_menu.in
+++ b/util/fluxbox-generate_menu.in
@@ -163,7 +163,7 @@ convertIcon(){
163 fi 163 fi
164 164
165 if [ "$1" == "$2" ]; then 165 if [ "$1" == "$2" ]; then
166 $ECHO "Files are in the same location: $1 == $2" >&2 166 # $VERBOSE "Files are in the same location: $1 == $2" >&2
167 # not really an error; just nothing to do. 167 # not really an error; just nothing to do.
168 return 0; 168 return 0;
169 fi 169 fi
@@ -172,7 +172,7 @@ convertIcon(){
172 172
173 # make sure it is an icon by checking if it has an extension 173 # make sure it is an icon by checking if it has an extension
174 if [ "$BASENAME" == "${BASENAME%%.*}" ]; then 174 if [ "$BASENAME" == "${BASENAME%%.*}" ]; then
175 $ECHO "File $1 does not have a filename extention." >&2 175 # $VERBOSE "File $1 does not have a filename extention." >&2
176 return 1; 176 return 1;
177 fi 177 fi
178 178
@@ -227,10 +227,10 @@ removePath(){
227 227
228doSearchLoop(){ 228doSearchLoop(){
229 for ICONPATH in "$@"; do 229 for ICONPATH in "$@"; do
230 #$ECHO ": $ICONPATH" >> $ICONMAPPING 230 ## $VERBOSE ": $ICONPATH" >> $ICONMAPPING
231 [ -d "$ICONPATH" ] || continue 231 [ -d "$ICONPATH" ] || continue
232 #echo -n "." 232 #echo -n "."
233 # $ECHO ":: $ICONPATH/$temp_icon" >> $ICONMAPPING 233 # # $VERBOSE ":: $ICONPATH/$temp_icon" >> $ICONMAPPING
234 if [ -f "$ICONPATH/$temp_icon" ]; then 234 if [ -f "$ICONPATH/$temp_icon" ]; then
235 echo "$ICONPATH/$temp_icon" 235 echo "$ICONPATH/$temp_icon"
236 return 0; 236 return 0;
@@ -238,7 +238,7 @@ doSearchLoop(){
238 # remove extension 238 # remove extension
239 iconNOext=${temp_icon%%.*} 239 iconNOext=${temp_icon%%.*}
240 [ -d "$ICONPATH" ] && for ICONEXT in .xpm .png .gif ; do 240 [ -d "$ICONPATH" ] && for ICONEXT in .xpm .png .gif ; do
241 #$ECHO "::: $ICONPATH/$iconNOext$ICONEXT" >> $ICONMAPPING 241 ## $VERBOSE "::: $ICONPATH/$iconNOext$ICONEXT" >> $ICONMAPPING
242 if [ -f "$ICONPATH/$iconNOext$ICONEXT" ]; then 242 if [ -f "$ICONPATH/$iconNOext$ICONEXT" ]; then
243 echo "$ICONPATH/$iconNOext$ICONEXT" 243 echo "$ICONPATH/$iconNOext$ICONEXT"
244 return 0; 244 return 0;
@@ -254,7 +254,7 @@ doSearch(){
254 # remove '(' from '(fluxbox ...) | ...' 254 # remove '(' from '(fluxbox ...) | ...'
255 local execname="${1//(}" 255 local execname="${1//(}"
256 local temp_icon="$2" 256 local temp_icon="$2"
257 $ECHO "# Searching for icon $temp_icon for $execname" >> $ICONMAPPING 257 # $VERBOSE "# Searching for icon $temp_icon for $execname" >> $ICONMAPPING
258 258
259 # check in $ICONMAPPING before searching directories 259 # check in $ICONMAPPING before searching directories
260 entry_icon=`grep -m 1 "^\"${execname}\"" $ICONMAPPING | grep -o '<.*>'` 260 entry_icon=`grep -m 1 "^\"${execname}\"" $ICONMAPPING | grep -o '<.*>'`
@@ -280,7 +280,7 @@ searchForIcon(){
280 # remove '&' and everything after it 280 # remove '&' and everything after it
281 entry_exec="${1%%&*}" 281 entry_exec="${1%%&*}"
282 entry_icon="$2" 282 entry_icon="$2"
283 $ECHO "searchForIcon \"$entry_exec\" \"$entry_icon\"" >&2 283 # $VERBOSE "searchForIcon \"$entry_exec\" \"$entry_icon\"" >&2
284 284
285 # get the basename and parameters of entry_exec -- no path 285 # get the basename and parameters of entry_exec -- no path
286 entry_exec=`removePath "${entry_exec}"` 286 entry_exec=`removePath "${entry_exec}"`
@@ -327,7 +327,7 @@ searchForIcon(){
327 if ! grep -q -m 1 "^.${entry_exec}.[[:space:]]*<.*/${icon_base}\....>" $ICONMAPPING 2> /dev/null; then 327 if ! grep -q -m 1 "^.${entry_exec}.[[:space:]]*<.*/${icon_base}\....>" $ICONMAPPING 2> /dev/null; then
328 echo -e "\"${entry_exec}\" \t <${entry_icon}>" >> $ICONMAPPING 328 echo -e "\"${entry_exec}\" \t <${entry_icon}>" >> $ICONMAPPING
329 else 329 else
330 $ECHO "# mapping already exists for ${entry_exec}" >> $ICONMAPPING 330 : echo "# mapping already exists for ${entry_exec}" >> $ICONMAPPING
331 fi 331 fi
332 else 332 else
333 echo "# No icon file found for $entry_exec" >> $ICONMAPPING 333 echo "# No icon file found for $entry_exec" >> $ICONMAPPING
@@ -336,9 +336,9 @@ searchForIcon(){
336 336
337toSingleLine(){ echo "$@"; } 337toSingleLine(){ echo "$@"; }
338createIconMapping(){ 338createIconMapping(){
339 $ECHO "# creating `date`" >> $ICONMAPPING 339 # $VERBOSE "# creating `date`" >> $ICONMAPPING
340 $ECHO "# using desktop files in $@" >> $ICONMAPPING 340 # $VERBOSE "# using desktop files in $@" >> $ICONMAPPING
341 $ECHO "# searching for icons in `eval toSingleLine $OTHER_ICONPATHS`" >> $ICONMAPPING 341 # $VERBOSE "# searching for icons in `eval toSingleLine $OTHER_ICONPATHS`" >> $ICONMAPPING
342 # need to determine when to use .fluxbox/icons/$execname.xpm over those listed in iconmapping 342 # need to determine when to use .fluxbox/icons/$execname.xpm over those listed in iconmapping
343 for DIR in "$@" ; do 343 for DIR in "$@" ; do
344 if [ -d "$DIR" ]; then 344 if [ -d "$DIR" ]; then
@@ -367,11 +367,9 @@ createIconMapping(){
367 ;; 367 ;;
368 esac 368 esac
369 done 369 done
370 else
371 $ECHO not exists: $DIR >&2
372 fi 370 fi
373 done 371 done
374 $ECHO "# done `date`" >> $ICONMAPPING 372 # $VERBOSE "# done `date`" >> $ICONMAPPING
375} 373}
376 374
377lookupIcon() { 375lookupIcon() {
@@ -390,14 +388,14 @@ lookupIcon() {
390 388
391 #echo "grepping ${execname}" 389 #echo "grepping ${execname}"
392 iconString=`grep -m 1 "^\"${execname}\"" $ICONMAPPING | grep -o '<.*>'` 390 iconString=`grep -m 1 "^\"${execname}\"" $ICONMAPPING | grep -o '<.*>'`
393 $ECHO "lookupIcon $execname, $iconString" >&2 391 # $VERBOSE "lookupIcon $execname, $iconString" >&2
394 392
395 if [ -z "$iconString" ] ; then 393 if [ -z "$iconString" ] ; then
396 iconString=`grep -m 1 "^\"${execname%% *}" $ICONMAPPING | grep -o '<.*>'` 394 iconString=`grep -m 1 "^\"${execname%% *}" $ICONMAPPING | grep -o '<.*>'`
397 fi 395 fi
398 396
399 if [ -z "$iconString" ] && [ -z "$PARSING_DESKTOP" ] ; then 397 if [ -z "$iconString" ] && [ -z "$PARSING_DESKTOP" ] ; then
400 #$ECHO "lookupIcon: Searching ... should only be needed for icons not gotten from *.desktop (manual-created ones): $execname" >&2 398 ## $VERBOSE "lookupIcon: Searching ... should only be needed for icons not gotten from *.desktop (manual-created ones): $execname" >&2
401 searchForIcon "$execname" "$execname" 399 searchForIcon "$execname" "$execname"
402 [ "$entry_icon" ] && iconString="<$entry_icon>" 400 [ "$entry_icon" ] && iconString="<$entry_icon>"
403 fi 401 fi
@@ -1272,7 +1270,7 @@ for KDE_PREFIX in "${KDE_PREFIX}" /usr/local /usr/X11R6 /usr /opt "${PREFIX}"; d
1272done 1270done
1273 1271
1274if [ -z "${INSTALL}" ]; then 1272if [ -z "${INSTALL}" ]; then
1275 [ -z "$ECHO" ] && ECHO=": echo" # for debugging 1273 # [ -z "$VERBOSE" ] && VERBOSE=": echo" # for debugging
1276 FB_ICONDIR="$HOME/.fluxbox/icons" 1274 FB_ICONDIR="$HOME/.fluxbox/icons"
1277 [ -d "$FB_ICONDIR" ] || mkdir "$FB_ICONDIR" 1275 [ -d "$FB_ICONDIR" ] || mkdir "$FB_ICONDIR"
1278 ICONMAPPING="$HOME/.fluxbox/iconmapping" 1276 ICONMAPPING="$HOME/.fluxbox/iconmapping"
@@ -1301,13 +1299,13 @@ if [ -z "${INSTALL}" ]; then
1301 OTHER_ICONPATHS=`eval checkDirs $OTHER_ICONPATHS` 1299 OTHER_ICONPATHS=`eval checkDirs $OTHER_ICONPATHS`
1302 OTHER_DESKTOP_PATHS=`eval checkDirs $OTHER_DESKTOP_PATHS` 1300 OTHER_DESKTOP_PATHS=`eval checkDirs $OTHER_DESKTOP_PATHS`
1303 1301
1304 $ECHO "Using USER_DESKTOP_PATHS=\"$USER_DESKTOP_PATHS\" and USER_ICONPATHS=\"$USER_ICONPATHS\"" 1302 # $VERBOSE "Using USER_DESKTOP_PATHS=\"$USER_DESKTOP_PATHS\" and USER_ICONPATHS=\"$USER_ICONPATHS\""
1305 $ECHO "Using OTHER_ICONPATHS=$OTHER_ICONPATHS" 1303 # $VERBOSE "Using OTHER_ICONPATHS=$OTHER_ICONPATHS"
1306 $ECHO "Using OTHER_DESKTOP_PATHS=$OTHER_DESKTOP_PATHS" 1304 # $VERBOSE "Using OTHER_DESKTOP_PATHS=$OTHER_DESKTOP_PATHS"
1307 $ECHO "Calling function: createIconMapping" 1305 # $VERBOSE "Calling function: createIconMapping"
1308 1306
1309 eval createIconMapping $USER_DESKTOP_PATHS $OTHER_DESKTOP_PATHS 1307 eval createIconMapping $USER_DESKTOP_PATHS $OTHER_DESKTOP_PATHS
1310 $ECHO "Done createIconMapping." 1308 # $VERBOSE "Done createIconMapping."
1311fi 1309fi
1312 1310
1313# directory for the backgrounds 1311# directory for the backgrounds