From a8583b79ae3cc1e5bc52df5a46fd341c1bdab22f Mon Sep 17 00:00:00 2001 From: slakmagik Date: Mon, 28 Mar 2011 23:21:15 -0400 Subject: [PATCH] avoid trailing spaces between app and closing } Add a few lines of code to prevent a few spaces in some menu output. '{$app $options}' would expand to '{app }' if no options were set. Also, while scattered throughout, in this particular spot the unnecessary braces around some of the variables (and not around some others) and inside flux's braces could be very visually confusing and lead to editing errors, so removed those. --- util/fluxbox-generate_menu.in | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/util/fluxbox-generate_menu.in b/util/fluxbox-generate_menu.in index 6e5b7a89..58b9da53 100755 --- a/util/fluxbox-generate_menu.in +++ b/util/fluxbox-generate_menu.in @@ -1314,6 +1314,11 @@ EOF fi BACKUPOPTIONS=$@ +if [ -n "$BACKUPOPTIONS" ]; then + FBGM_CMD="@pkgprefix@fluxbox-generate_menu@pkgsuffix@ $BACKUPOPTIONS" +else + FBGM_CMD=@pkgprefix@fluxbox-generate_menu@pkgsuffix@ +fi # Get options. while [ $# -gt 0 ]; do case "$1" in @@ -1530,6 +1535,13 @@ DEFAULT_BROWSERNAME=`basename $DEFAULT_BROWSERNAME` if [ -z "$LAUNCHER" ]; then LAUNCHER=@pkgprefix@fbrun@pkgsuffix@ fi +if [ -n "$FBRUNOPTIONS" ]; then + # with this, LAUNCHER should be renamed LAUNCHER_NAME, but then there's + # backwards-compatibility... + LAUNCHER_CMD="$LAUNCHER $FBRUNOPTIONS" +else + LAUNCHER_CMD=$LAUNCHER +fi # Start of menu cat << EOF > ${MENUFILENAME} @@ -1570,7 +1582,7 @@ case "$DEFAULT_BROWSERNAME" in *) append "[exec] ($DEFAULT_BROWSERNAME) {$DEFAULT_BROWSER}" ;; esac -find_it "${LAUNCHER}" append "[exec] (${RUNCOMMAND}) {${LAUNCHER} $FBRUNOPTIONS}" +find_it "${LAUNCHER}" append "[exec] (${RUNCOMMAND}) {$LAUNCHER_CMD}" append_submenu "${TERMINALMENU}" @@ -1859,10 +1871,10 @@ append_submenu "${FBSETTINGSMENU}" "[exec] (${WINDOWNAME}) {xprop WM_CLASS|cut -d \\\" -f 2|xmessage -file - -center}" find_it import append "[exec] (${SCREENSHOT} - JPG) {import screenshot.jpg && display -resize 50% screenshot.jpg}" find_it import append "[exec] (${SCREENSHOT} - PNG) {import screenshot.png && display -resize 50% screenshot.png}" - find_it ${LAUNCHER} append "[exec] (${RUNCOMMAND}) {${LAUNCHER} $FBRUNOPTIONS}" + find_it ${LAUNCHER} append "[exec] (${RUNCOMMAND}) {$LAUNCHER_CMD}" find_it switch append "[exec] (gtk-theme-switch) {switch}" find_it switch2 append "[exec] (gtk2-theme-switch) {switch2}" - find_it @pkgprefix@fluxbox-generate_menu@pkgsuffix@ append "[exec] (${REGENERATEMENU}) {@pkgprefix@fluxbox-generate_menu@pkgsuffix@ ${BACKUPOPTIONS}}" + find_it @pkgprefix@fluxbox-generate_menu@pkgsuffix@ append "[exec] (${REGENERATEMENU}) {$FBGM_CMD}" append_menu_end append_submenu "${WINDOWMANAGERS}"