aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authormathias <mathias>2005-02-10 02:01:15 (GMT)
committermathias <mathias>2005-02-10 02:01:15 (GMT)
commit6e15a329736306595b9611087fced2650adda5c4 (patch)
tree53b107b51ba40fb9fbfdd8fdafefa81a1422fb24 /util
parentb1b4008ce72fe8988da30308137a7addff7d168f (diff)
downloadfluxbox_paul-6e15a329736306595b9611087fced2650adda5c4.zip
fluxbox_paul-6e15a329736306595b9611087fced2650adda5c4.tar.bz2
more portability-stuff from dung, mostly for variables
Diffstat (limited to 'util')
-rwxr-xr-xutil/fluxbox-generate_menu.in44
1 files changed, 29 insertions, 15 deletions
diff --git a/util/fluxbox-generate_menu.in b/util/fluxbox-generate_menu.in
index 2547d59..5639406 100755
--- a/util/fluxbox-generate_menu.in
+++ b/util/fluxbox-generate_menu.in
@@ -82,6 +82,7 @@ Options:
82 -i other path(s) to search for icons 82 -i other path(s) to search for icons
83 e.g., "/usr/kde/3.3/share/icons/crystalsvg/16x16/*" 83 e.g., "/usr/kde/3.3/share/icons/crystalsvg/16x16/*"
84 -is wider search for icons (worth the extra time) 84 -is wider search for icons (worth the extra time)
85 -in skip icon search
85 86
86 -t Favourite terminal 87 -t Favourite terminal
87 -w Homepage for console-browsers. Default is fluxbox.org 88 -w Homepage for console-browsers. Default is fluxbox.org
@@ -188,7 +189,8 @@ convertIcon(){
188 return 0; 189 return 0;
189 fi 190 fi
190 191
191 local BASENAME="${1##*/}" 192 local BASENAME
193 BASENAME="${1##*/}"
192 194
193 # make sure it is an icon by checking if it has an extension 195 # make sure it is an icon by checking if it has an extension
194 if [ "$BASENAME" = "${BASENAME%%.*}" ]; then 196 if [ "$BASENAME" = "${BASENAME%%.*}" ]; then
@@ -231,14 +233,16 @@ convertIcon(){
231 233
232removePath(){ 234removePath(){
233 execname="$1" 235 execname="$1"
234 local progname="${execname%% *}" 236 local progname
237 progname="${execname%% *}"
235 # separate program name and its parameters 238 # separate program name and its parameters
236 if [ "$progname" = "$execname" ]; then 239 if [ "$progname" = "$execname" ]; then
237 # no params 240 # no params
238 # remove path from only program name 241 # remove path from only program name
239 execname="${progname##*/}" 242 execname="${progname##*/}"
240 else 243 else
241 local params="${execname#* }" 244 local params
245 params="${execname#* }"
242 # remove path from only program name 246 # remove path from only program name
243 execname="${progname##*/} $params" 247 execname="${progname##*/} $params"
244 fi 248 fi
@@ -272,8 +276,9 @@ doSearchLoop(){
272 276
273doSearch(){ 277doSearch(){
274 # remove '(' from '(fluxbox ...) | ...' 278 # remove '(' from '(fluxbox ...) | ...'
275 local execname=`replaceWithinString "$1" "\("` 279 local execname temp_icon
276 local temp_icon="$2" 280 execname=`replaceWithinString "$1" "\("`
281 temp_icon="$2"
277 # $dnlamVERBOSE "# Searching for icon $temp_icon for $execname" >> $ICONMAPPING 282 # $dnlamVERBOSE "# Searching for icon $temp_icon for $execname" >> $ICONMAPPING
278 283
279 # check in $ICONMAPPING before searching directories 284 # check in $ICONMAPPING before searching directories
@@ -310,7 +315,8 @@ searchForIcon(){
310 if [ -n "$entry_icon" ] && [ ! "$entry_exec" = "$entry_icon" ] && [ ! -f "$entry_icon" ]; then 315 if [ -n "$entry_icon" ] && [ ! "$entry_exec" = "$entry_icon" ] && [ ! -f "$entry_icon" ]; then
311 # to search for icon in other paths, 316 # to search for icon in other paths,
312 # get basename 317 # get basename
313 local temp_icon="${entry_icon##*/}" 318 local temp_icon
319 temp_icon="${entry_icon##*/}"
314 # remove parameters 320 # remove parameters
315 temp_icon="${temp_icon#* }" 321 temp_icon="${temp_icon#* }"
316 # clear entry_icon until temp_icon is found 322 # clear entry_icon until temp_icon is found
@@ -322,7 +328,8 @@ searchForIcon(){
322 fi 328 fi
323 329
324 # remove parameters 330 # remove parameters
325 local execname="${entry_exec%% *}" 331 local execname
332 execname="${entry_exec%% *}"
326 333
327 # echo "search for icon named $execname.{xpm,png,gif}" 334 # echo "search for icon named $execname.{xpm,png,gif}"
328 if [ ! -f "$entry_icon" ]; then 335 if [ ! -f "$entry_icon" ]; then
@@ -339,7 +346,8 @@ searchForIcon(){
339 fi 346 fi
340 347
341 # remove path to icon; just get basename 348 # remove path to icon; just get basename
342 local icon_base="${entry_icon##*/}" 349 local icon_base
350 icon_base="${entry_icon##*/}"
343 # remove extension 351 # remove extension
344 icon_base="${icon_base%%.*}" 352 icon_base="${icon_base%%.*}"
345 # echo "^.${entry_exec}.[[:space:]]*<.*/${icon_base}\....>" 353 # echo "^.${entry_exec}.[[:space:]]*<.*/${icon_base}\....>"
@@ -401,7 +409,8 @@ lookupIcon() {
401 return 1 409 return 1
402 fi 410 fi
403 411
404 local execname="$1" 412 local execname
413 execname="$1"
405 shift 414 shift
406 [ -n "$1" ] && echo "!! Ignoring extra paramters: $*" >&2 415 [ -n "$1" ] && echo "!! Ignoring extra paramters: $*" >&2
407 416
@@ -429,12 +438,14 @@ lookupIcon() {
429append() { 438append() {
430 if [ -z "${INSTALL}" ]; then 439 if [ -z "${INSTALL}" ]; then
431 # $dnlamVERBOSE echo "append: $*" >&2 440 # $dnlamVERBOSE echo "append: $*" >&2
432 local iconString="`echo $* | grep -o '<.*>'`" 441 local iconString
442 iconString="`echo $* | grep -o '<.*>'`"
433 # echo "iconString=$iconString" >&2 443 # echo "iconString=$iconString" >&2
434 if [ -z "$iconString" ]; then 444 if [ -z "$iconString" ] && [ -z "$NO_ICON" ]; then
435 echo -n " $* " >> ${MENUFILENAME} 445 echo -n " $* " >> ${MENUFILENAME}
436 # get the program name between '{}' from parameters 446 # get the program name between '{}' from parameters
437 local execname="$*" 447 local execname
448 execname="$*"
438 execname=${execname#*\{} 449 execname=${execname#*\{}
439 execname=${execname%%\}*} 450 execname=${execname%%\}*}
440 # $dnlamVERBOSE echo "execname=$execname" >&2 451 # $dnlamVERBOSE echo "execname=$execname" >&2
@@ -1235,6 +1246,7 @@ while [ $# -gt 0 ]; do
1235 -B) BACKGROUNDMENUITEM=yes; shift;; 1246 -B) BACKGROUNDMENUITEM=yes; shift;;
1236 -k) KDEMENU=yes; shift;; 1247 -k) KDEMENU=yes; shift;;
1237 -g) GNOMEMENU=yes; shift;; 1248 -g) GNOMEMENU=yes; shift;;
1249 -in) NO_ICON=yes; shift;;
1238 -is) OTHER_ICONPATHS=" 1250 -is) OTHER_ICONPATHS="
1239 /usr{,/local}/share{,/xclass}/{icons,pixmaps} 1251 /usr{,/local}/share{,/xclass}/{icons,pixmaps}
1240 /usr{,/local}/share/icons/mini 1252 /usr{,/local}/share/icons/mini
@@ -1334,7 +1346,7 @@ for KDE_PREFIX in "${KDE_PREFIX}" /usr/local /usr/X11R6 /usr /opt "${PREFIX}"; d
1334 fi 1346 fi
1335done 1347done
1336 1348
1337if [ -z "${INSTALL}" ]; then 1349if [ -z "${INSTALL}" ] && [ -z "${NO_ICON}" ]; then
1338 # [ -z "$dnlamVERBOSE" ] && dnlamVERBOSE=": echo" # for debugging 1350 # [ -z "$dnlamVERBOSE" ] && dnlamVERBOSE=": echo" # for debugging
1339 FB_ICONDIR="$HOME/.fluxbox/icons" 1351 FB_ICONDIR="$HOME/.fluxbox/icons"
1340 [ -d "$FB_ICONDIR" ] || mkdir "$FB_ICONDIR" 1352 [ -d "$FB_ICONDIR" ] || mkdir "$FB_ICONDIR"
@@ -1349,8 +1361,9 @@ if [ -z "${INSTALL}" ]; then
1349 [ "OTHER_ICONPATHS" ] && OTHER_ICONPATHS="\"$HOME\"/.kde/share/icons/{,*} $OTHER_ICONPATHS" 1361 [ "OTHER_ICONPATHS" ] && OTHER_ICONPATHS="\"$HOME\"/.kde/share/icons/{,*} $OTHER_ICONPATHS"
1350 fi 1362 fi
1351 [ "$GNOMEMENU$KDEMENU" ] && OTHER_DESKTOP_PATHS="\"$ETCAPPLNK\" $OTHER_DESKTOP_PATHS" 1363 [ "$GNOMEMENU$KDEMENU" ] && OTHER_DESKTOP_PATHS="\"$ETCAPPLNK\" $OTHER_DESKTOP_PATHS"
1352 1364
1353 checkDirs(){ 1365 checkDirs(){
1366 #echo checkDirs: $* >&2
1354 local CHECKED_DIRS="" 1367 local CHECKED_DIRS=""
1355 for DIR in "$@"; do 1368 for DIR in "$@"; do
1356 if [ -d "$DIR" ]; then 1369 if [ -d "$DIR" ]; then
@@ -1358,6 +1371,7 @@ if [ -z "${INSTALL}" ]; then
1358 CHECKED_DIRS="$CHECKED_DIRS \"$DIR\"" 1371 CHECKED_DIRS="$CHECKED_DIRS \"$DIR\""
1359 fi 1372 fi
1360 done 1373 done
1374 #echo checkDirs - $CHECKED_DIRS >&2
1361 echo $CHECKED_DIRS 1375 echo $CHECKED_DIRS
1362 } 1376 }
1363 1377
@@ -1369,7 +1383,7 @@ if [ -z "${INSTALL}" ]; then
1369 # $dnlamVERBOSE "Using OTHER_DESKTOP_PATHS=$OTHER_DESKTOP_PATHS" 1383 # $dnlamVERBOSE "Using OTHER_DESKTOP_PATHS=$OTHER_DESKTOP_PATHS"
1370 # $dnlamVERBOSE "Calling function: createIconMapping" 1384 # $dnlamVERBOSE "Calling function: createIconMapping"
1371 1385
1372 # $dnlamVERBOSE echo "Creating $ICONMAPPING" >&2 1386 # $dnlamVERBOSE "Creating $ICONMAPPING" >&2
1373 touch "$ICONMAPPING" 1387 touch "$ICONMAPPING"
1374 eval createIconMapping $USER_DESKTOP_PATHS $OTHER_DESKTOP_PATHS 1388 eval createIconMapping $USER_DESKTOP_PATHS $OTHER_DESKTOP_PATHS
1375 # $dnlamVERBOSE "Done createIconMapping." 1389 # $dnlamVERBOSE "Done createIconMapping."