diff options
Diffstat (limited to 'util')
-rwxr-xr-x | util/fluxbox-generate_menu.in | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/util/fluxbox-generate_menu.in b/util/fluxbox-generate_menu.in index eafb793..141cafb 100755 --- a/util/fluxbox-generate_menu.in +++ b/util/fluxbox-generate_menu.in | |||
@@ -38,6 +38,7 @@ | |||
38 | # - don't use id -u or $UID, use whoami | 38 | # - don't use id -u or $UID, use whoami |
39 | # - getopts won't work on all platforms, but the config-file can | 39 | # - getopts won't work on all platforms, but the config-file can |
40 | # compensate for that. | 40 | # compensate for that. |
41 | # - OpenBSD and Solaris grep do not have the -m option | ||
41 | # - various software like grep/sed/perl may be not present or not | 42 | # - various software like grep/sed/perl may be not present or not |
42 | # the version you have. for example grep '\W' only works on gnu-grep. | 43 | # the version you have. for example grep '\W' only works on gnu-grep. |
43 | # Keep this in mind, use bare basic defaults. | 44 | # Keep this in mind, use bare basic defaults. |
@@ -271,7 +272,7 @@ doSearch(){ | |||
271 | # $dnlamVERBOSE "# Searching for icon $temp_icon for $execname" >> $ICONMAPPING | 272 | # $dnlamVERBOSE "# Searching for icon $temp_icon for $execname" >> $ICONMAPPING |
272 | 273 | ||
273 | # check in $ICONMAPPING before searching directories | 274 | # check in $ICONMAPPING before searching directories |
274 | entry_icon=`grep -m 1 "^\"${execname}\"" $ICONMAPPING | grep -o '<.*>'` | 275 | entry_icon=`grep "^\"${execname}\"" $ICONMAPPING | head -n 1 | grep -o '<.*>'` |
275 | if [ -n "$entry_icon" ]; then | 276 | if [ -n "$entry_icon" ]; then |
276 | entry_icon=`replaceWithinString "$entry_icon" "<"` | 277 | entry_icon=`replaceWithinString "$entry_icon" "<"` |
277 | entry_icon=`replaceWithinString "$entry_icon" ">"` | 278 | entry_icon=`replaceWithinString "$entry_icon" ">"` |
@@ -365,16 +366,16 @@ createIconMapping(){ | |||
365 | # >> $ICONMAPPING | 366 | # >> $ICONMAPPING |
366 | find "$DIR" -type f -name "*.desktop" | while read DESKTOP_FILE; do | 367 | find "$DIR" -type f -name "*.desktop" | while read DESKTOP_FILE; do |
367 | # echo $DESKTOP_FILE; | 368 | # echo $DESKTOP_FILE; |
368 | #entry_name=`grep -m 1 '^[ ]*Name=' $DESKTOP_FILE` | 369 | #entry_name=`grep '^[ ]*Name=' $DESKTOP_FILE | head -n 1` |
369 | #entry_name=${entry_name##*=} | 370 | #entry_name=${entry_name##*=} |
370 | entry_exec=`grep -m 1 '^[ ]*Exec=' "$DESKTOP_FILE"` | 371 | entry_exec=`grep '^[ ]*Exec=' "$DESKTOP_FILE" | head -n 1` |
371 | entry_exec=${entry_exec##*=} | 372 | entry_exec=${entry_exec##*=} |
372 | entry_exec=`replaceWithinString "$entry_exec" "\""` | 373 | entry_exec=`replaceWithinString "$entry_exec" "\""` |
373 | if [ -z "$entry_exec" ]; then | 374 | if [ -z "$entry_exec" ]; then |
374 | entry_exec=${DESKTOP_FILE%%.desktop*} | 375 | entry_exec=${DESKTOP_FILE%%.desktop*} |
375 | fi | 376 | fi |
376 | 377 | ||
377 | entry_icon=`grep -m 1 '^[ ]*Icon=' "$DESKTOP_FILE"` | 378 | entry_icon=`grep '^[ ]*Icon=' "$DESKTOP_FILE" | head -n 1` |
378 | entry_icon=${entry_icon##*=} | 379 | entry_icon=${entry_icon##*=} |
379 | 380 | ||
380 | # $dnlamVERBOSE echo "--- $entry_exec $entry_icon" >&2 | 381 | # $dnlamVERBOSE echo "--- $entry_exec $entry_icon" >&2 |
@@ -407,11 +408,11 @@ lookupIcon() { | |||
407 | execname=`removePath "$execname"` | 408 | execname=`removePath "$execname"` |
408 | 409 | ||
409 | #echo "grepping ${execname}" | 410 | #echo "grepping ${execname}" |
410 | iconString=`grep -m 1 "^\"${execname}\"" $ICONMAPPING | grep -o '<.*>'` | 411 | iconString=`grep "^\"${execname}\"" $ICONMAPPING | head -n 1 | grep -o '<.*>'` |
411 | # $dnlamVERBOSE "lookupIcon $execname, $iconString" >&2 | 412 | # $dnlamVERBOSE "lookupIcon $execname, $iconString" >&2 |
412 | 413 | ||
413 | if [ -z "$iconString" ] ; then | 414 | if [ -z "$iconString" ] ; then |
414 | iconString=`grep -m 1 "^\"${execname%% *}" $ICONMAPPING | grep -o '<.*>'` | 415 | iconString=`grep "^\"${execname%% *}" $ICONMAPPING | head -n 1 | grep -o '<.*>'` |
415 | fi | 416 | fi |
416 | 417 | ||
417 | if [ -z "$iconString" ] && [ -z "$PARSING_DESKTOP" ] ; then | 418 | if [ -z "$iconString" ] && [ -z "$PARSING_DESKTOP" ] ; then |