summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xutil/fluxbox-generate_menu53
1 files changed, 26 insertions, 27 deletions
diff --git a/util/fluxbox-generate_menu b/util/fluxbox-generate_menu
index 2fbe73a..f3ee4a2 100755
--- a/util/fluxbox-generate_menu
+++ b/util/fluxbox-generate_menu
@@ -22,7 +22,7 @@
22# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23# DEALINGS IN THE SOFTWARE. 23# DEALINGS IN THE SOFTWARE.
24# 24#
25# $Id: fluxbox-generate_menu,v 1.48 2003/08/05 12:36:54 rathnor Exp $ 25# $Id: fluxbox-generate_menu,v 1.49 2003/08/07 10:35:19 fluxgen Exp $
26 26
27# 27#
28# Portability notes: 28# Portability notes:
@@ -40,16 +40,16 @@
40# the version you have. for example grep '\W' only works on gnu-grep. 40# the version you have. for example grep '\W' only works on gnu-grep.
41# Keep this in mind, use bare basic defaults. 41# Keep this in mind, use bare basic defaults.
42# - Do _NOT_ suggest to use #!/bin/bash. Not everybody uses bash. 42# - Do _NOT_ suggest to use #!/bin/bash. Not everybody uses bash.
43# Non portable features like getopts in this script can be achieved in 43# Non portable features like getopts in this script can be achieved in
44# other ways. 44# other ways.
45 45
46 46
47WHOAMI=`whoami` 47WHOAMI=`whoami`
48[ "$WHOAMI" = "root" ] && PATH=/bin:/usr/bin/:/usr/local/bin:/usr/X11R6/bin 48[ "$WHOAMI" = root ] && PATH=/bin:/usr/bin/:/usr/local/bin:/usr/X11R6/bin
49 49
50# Functions 50# Functions
51display_usage() { 51display_usage() {
52 cat <<EOF 52 cat << EOF
53Usage: fluxbox-generate_menu [-kgrBh] [-t terminal] [-w url] [-b browser] 53Usage: fluxbox-generate_menu [-kgrBh] [-t terminal] [-w url] [-b browser]
54 [-m menu-title] [-o /path] [-u /path] [-p /path] [-n /path] [-q /path] 54 [-m menu-title] [-o /path] [-u /path] [-p /path] [-n /path] [-q /path]
55EOF 55EOF
@@ -57,7 +57,7 @@ EOF
57 57
58display_help() { 58display_help() {
59 display_usage 59 display_usage
60 cat <<EOF 60 cat << EOF
61 61
62Options: 62Options:
63 63
@@ -91,7 +91,7 @@ EOF
91} 91}
92 92
93display_authors() { 93display_authors() {
94 cat <<EOF 94 cat << EOF
95 95
96fluxbox-generate_menu was brought to you by: 96fluxbox-generate_menu was brought to you by:
97 97
@@ -110,7 +110,7 @@ case `uname` in
110 Linux|*BSD) 110 Linux|*BSD)
111 find_it() { 111 find_it() {
112 which $1 > /dev/null 2>&1 && shift && $* 112 which $1 > /dev/null 2>&1 && shift && $*
113 } 113 }
114 ;; 114 ;;
115 *) 115 *)
116 find_it() { 116 find_it() {
@@ -142,7 +142,7 @@ append_submenu() {
142} 142}
143 143
144append_menu_end() { 144append_menu_end() {
145 append_menu "[end]" 145 append_menu '[end]'
146 [ "${REMOVE}" ] && echo >> ${MENUFILENAME} # only an empty line in templates 146 [ "${REMOVE}" ] && echo >> ${MENUFILENAME} # only an empty line in templates
147} 147}
148 148
@@ -547,13 +547,13 @@ USERMENU="${USERMENU:=${HOME}/.fluxbox/usermenu}"
547 547
548# Read the menuconfig file if it exists or else create it. 548# Read the menuconfig file if it exists or else create it.
549# But not during install time, use envvar for sun 549# But not during install time, use envvar for sun
550if [ ! "${INSTALL}" = "Yes" ];then 550if [ ! "${INSTALL}" = Yes ]; then
551 if [ -r ${HOME}/.fluxbox/menuconfig ]; then 551 if [ -r ${HOME}/.fluxbox/menuconfig ]; then
552 . ${HOME}/.fluxbox/menuconfig 552 . ${HOME}/.fluxbox/menuconfig
553 else 553 else
554 if [ ! "$WHOAMI" = root ]; then # this is only for users. 554 if [ ! "$WHOAMI" = root ]; then # this is only for users.
555 if touch ${HOME}/.fluxbox/menuconfig; then 555 if touch ${HOME}/.fluxbox/menuconfig; then
556 cat<<EOF> ${HOME}/.fluxbox/menuconfig 556 cat << EOF > ${HOME}/.fluxbox/menuconfig
557# This file is read by fluxbox-generate_menu. If you don't like a 557# This file is read by fluxbox-generate_menu. If you don't like a
558# default you can change it here. Don't forget to remove the # in front 558# default you can change it here. Don't forget to remove the # in front
559# of the line. 559# of the line.
@@ -644,7 +644,7 @@ done
644# Check defaults 644# Check defaults
645 645
646# Can we actually create ${MENUFILENAME} 646# Can we actually create ${MENUFILENAME}
647touch ${MENUFILENAME} 2>/dev/null 647touch ${MENUFILENAME} 2> /dev/null
648if [ $? -ne 0 ]; then 648if [ $? -ne 0 ]; then
649 echo "Fatal error: can't create or write to $MENUFILENAME" >&2 649 echo "Fatal error: can't create or write to $MENUFILENAME" >&2
650 exit 1 650 exit 1
@@ -685,9 +685,11 @@ if [ -z "$BACKGROUND_DIRS" ]; then
685fi 685fi
686 686
687# find the default terminal 687# find the default terminal
688find_it $MY_TERM 688
689if [ $? -ne 0 ]; then 689if find_it $MY_TERM; then
690 echo "Warning: you chose an invalid term." >&2 690 DEFAULT_TERM=$MY_TERM
691else
692 [ -n "$MY_TERM" ] && echo "Warning: you chose an invalid term." >&2
691 #The precise order is up for debate. 693 #The precise order is up for debate.
692 for term in Eterm aterm rxvt wterm xterm konsole gnome-terminal; do 694 for term in Eterm aterm rxvt wterm xterm konsole gnome-terminal; do
693 if find_it $term; then 695 if find_it $term; then
@@ -695,30 +697,27 @@ if [ $? -ne 0 ]; then
695 break 697 break
696 fi 698 fi
697 done 699 done
698else
699 DEFAULT_TERM=$MY_TERM
700fi 700fi
701 701
702 702
703# find the default browser 703# find the default browser
704find_it $MY_BROWSER 704if find_it $MY_BROWSER; then
705if [ $? -ne 0 ]; then 705 DEFAULT_BROWSER=$MY_BROWSER
706 echo "Warning: you chose an invalid browser." >&2 706else
707 [ -n "$MY_BROWSER" ] && echo "Warning: you chose an invalid browser." >&2
707 #The precise order is up for debate. 708 #The precise order is up for debate.
708 for browser in MozillaFirebird firebird opera skipstone phoenix mozilla galeon konqueror dillo netscape links w3m lynx; do 709 for browser in mozilla-firebird MozillaFirebird opera skipstone mozilla galeon konqueror dillo netscape w3m links lynx; do
709 if find_it $browser; then 710 if find_it $browser; then
710 DEFAULT_BROWSER=$browser 711 DEFAULT_BROWSER=$browser
711 break 712 break
712 fi 713 fi
713 done 714 done
714else
715 DEFAULT_BROWSER=$MY_BROWSER
716fi 715fi
717 716
718 717
719# a unix system without any terms. that's odd 718# a unix system without any terms. that's odd
720if [ -z "$DEFAULT_TERM" ]; then 719if [ -z "$DEFAULT_TERM" ]; then
721 cat <<EOF>&2 720 cat << EOF >&2
722Warning: I can't find any terminal-emulators in your PATH. 721Warning: I can't find any terminal-emulators in your PATH.
723Please fix your PATH or specify your favourite terminal with the -t option 722Please fix your PATH or specify your favourite terminal with the -t option
724EOF 723EOF
@@ -910,9 +909,9 @@ append_submenu "${FBSETTINGSMENU}"
910 append "[exec] (${picturename%.???}) {fbsetbg -f \"$1\" }" 909 append "[exec] (${picturename%.???}) {fbsetbg -f \"$1\" }"
911 } 910 }
912 911
913 if [ "$BACKGROUNDMENUITEM" = "yes" ]; then 912 if [ "$BACKGROUNDMENUITEM" = yes ]; then
914 IFS=: # set delimetor for find 913 IFS=: # set delimetor for find
915 NUMBER_OF_BACKGROUNDS=`find $BACKGROUND_DIRS -follow -type f 2>/dev/null|wc -l` 914 NUMBER_OF_BACKGROUNDS=`find $BACKGROUND_DIRS -follow -type f 2> /dev/null|wc -l`
916 if [ "$NUMBER_OF_BACKGROUNDS" -gt 0 ]; then 915 if [ "$NUMBER_OF_BACKGROUNDS" -gt 0 ]; then
917 append_menu "[submenu] (${BACKGROUNDMENU}) {${BACKGROUNDMENUTITLE}}" 916 append_menu "[submenu] (${BACKGROUNDMENU}) {${BACKGROUNDMENUTITLE}}"
918 if [ "$NUMBER_OF_BACKGROUNDS" -gt 30 ]; then 917 if [ "$NUMBER_OF_BACKGROUNDS" -gt 30 ]; then
@@ -959,7 +958,7 @@ append_submenu "${FBSETTINGSMENU}"
959 958
960 append_submenu ${WINDOWMANAGERS} 959 append_submenu ${WINDOWMANAGERS}
961 #hard to properly maintain since there are so many exceptions to the rule. 960 #hard to properly maintain since there are so many exceptions to the rule.
962 for wm in icewm ion kde sawfish enlightenment openbox evilwm waimea xfce pekwm;do 961 for wm in icewm ion kde sawfish enlightenment openbox evilwm waimea xfce pekwm; do
963 find_it start${wm} append "[restart] (${wm}) {start${wm}}" ||\ 962 find_it start${wm} append "[restart] (${wm}) {start${wm}}" ||\
964 find_it ${wm} append "[restart] (${wm}) {${wm}}" 963 find_it ${wm} append "[restart] (${wm}) {${wm}}"
965 done 964 done