aboutsummaryrefslogtreecommitdiff
path: root/util/fluxbox-generate_menu
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-04-14 09:23:40 (GMT)
committerfluxgen <fluxgen>2003-04-14 09:23:40 (GMT)
commitb234bdae642b2403ad78ef1a90dd046a32a523d4 (patch)
tree4200fc519591e7d821ce1deeddd098ba4914361a /util/fluxbox-generate_menu
parent2623f307c0695d2d478e04c23dd59d1f656e0e94 (diff)
downloadfluxbox_pavel-b234bdae642b2403ad78ef1a90dd046a32a523d4.zip
fluxbox_pavel-b234bdae642b2403ad78ef1a90dd046a32a523d4.tar.bz2
do not create menuconfig during install, some style cleanups - Han
Diffstat (limited to 'util/fluxbox-generate_menu')
-rwxr-xr-xutil/fluxbox-generate_menu58
1 files changed, 32 insertions, 26 deletions
diff --git a/util/fluxbox-generate_menu b/util/fluxbox-generate_menu
index af4c11b..c1c578b 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.28 2003/04/09 08:59:03 fluxgen Exp $ 25# $Id: fluxbox-generate_menu,v 1.29 2003/04/14 09:23:40 fluxgen Exp $
26 26
27# 27#
28# Portability notes: 28# Portability notes:
@@ -91,9 +91,9 @@ fluxbox-generate_menu was brought to you by:
91 91
92 Henrik Kinnunen: Project leader. 92 Henrik Kinnunen: Project leader.
93 Han Boetes: Packaging, debugging and scripts. 93 Han Boetes: Packaging, debugging and scripts.
94 Simon Bowden: Cleanups and compatibility for sun.
94 Jeramy B. Smith: Packaging assistance, gnome and kde menu system. 95 Jeramy B. Smith: Packaging assistance, gnome and kde menu system.
95 Filippo Pappalardo: Italian locales and -t option. 96 Filippo Pappalardo: Italian locales and -t option.
96 Simon Bowden: Cleanups and compatibility for sun.
97 $WHOAMI: Innocent bystander. 97 $WHOAMI: Innocent bystander.
98 98
99EOF 99EOF
@@ -480,17 +480,20 @@ case ${LC_ALL} in
480esac 480esac
481 481
482# Set Defaults 482# Set Defaults
483FILENAME="${HOME}/.fluxbox/menu" 483FILENAME="${FILENAME:=${HOME}/.fluxbox/menu}"
484MENUTITLE="Fluxbox" 484MENUTITLE="${MENUTITLE:=Fluxbox}"
485HOMEPAGE="fluxbox.org" 485HOMEPAGE="${HOMEPAGE:=fluxbox.org}"
486USERMENU="${HOME}/.fluxbox/usermenu" 486USERMENU="${USERMENU:=${HOME}/.fluxbox/usermenu}"
487 487
488# Read the menuconfig file if it exists or else create it. 488# Read the menuconfig file if it exists or else create it.
489if [ -r ${HOME}/.fluxbox/menuconfig ];then 489# But not during install time, use envvar for sun
490 . ${HOME}/.fluxbox/menuconfig 490if [ ! ${INSTALL}="Yes" ];then
491else 491 if [ -r ${HOME}/.fluxbox/menuconfig ]; then
492 if [ ! "$WHOAMI" = root ];then # this is only for users. 492 . ${HOME}/.fluxbox/menuconfig
493 cat<<EOF> ${HOME}/.fluxbox/menuconfig 493 else
494 if [ ! "$WHOAMI" = root ]; then # this is only for users.
495 if touch ${HOME}/.fluxbox/menuconfig; then
496 cat<<EOF> ${HOME}/.fluxbox/menuconfig
494# This file is read by fluxbox-generate_menu. If you don't like a 497# This file is read by fluxbox-generate_menu. If you don't like a
495# default you can change it here. Don't forget to remove the # in front 498# default you can change it here. Don't forget to remove the # in front
496# of the line. 499# of the line.
@@ -539,9 +542,12 @@ else
539# REMOVE=no 542# REMOVE=no
540 543
541EOF 544EOF
545 else
546 echo "Warning: I could't create ${HOME}/.fluxbox/menuconfig" >&2
547 fi
548 fi
542 fi 549 fi
543fi 550fi
544
545# Get options. 551# Get options.
546while getopts ":Bkhragb:t:p:w:u:n:q:o:m:" COMMAND_LINE_ARGUMENT ; do 552while getopts ":Bkhragb:t:p:w:u:n:q:o:m:" COMMAND_LINE_ARGUMENT ; do
547 case "${COMMAND_LINE_ARGUMENT}" in 553 case "${COMMAND_LINE_ARGUMENT}" in
@@ -567,14 +573,14 @@ done
567 573
568# Can we actually create ${FILENAME} 574# Can we actually create ${FILENAME}
569touch ${FILENAME} 2> /dev/null 575touch ${FILENAME} 2> /dev/null
570if [ $? -ne 0 ] ; then 576if [ $? -ne 0 ]; then
571 echo "Fatal error: can't create $FILENAME" >&2 577 echo "Fatal error: can't create $FILENAME" >&2
572 exit 1 578 exit 1
573fi 579fi
574 580
575# backup menu 581# backup menu
576if [ -w "${FILENAME}" ]; then 582if [ -w "${FILENAME}" ]; then
577 if [ -f ${FILENAME}.firstbak ];then 583 if [ -f ${FILENAME}.firstbak ]; then
578 cp ${FILENAME} ${FILENAME}.firstbak 584 cp ${FILENAME} ${FILENAME}.firstbak
579 fi 585 fi
580 mv ${FILENAME} ${FILENAME}.bak 586 mv ${FILENAME} ${FILENAME}.bak
@@ -582,7 +588,7 @@ fi
582 588
583# packagedatadir 589# packagedatadir
584if [ ! -d "${PKGDATADIR}" -o -z "${PKGDATADIR}" ]; then 590if [ ! -d "${PKGDATADIR}" -o -z "${PKGDATADIR}" ]; then
585 if [ "`uname`" = "Linux" ];then 591 if [ "`uname`" = "Linux" ]; then
586 PKGDATADIR=/usr/share 592 PKGDATADIR=/usr/share
587 else 593 else
588 PKGDATADIR=/usr/local/share 594 PKGDATADIR=/usr/local/share
@@ -602,7 +608,7 @@ fi
602 608
603# find the default terminal 609# find the default terminal
604find_it $MY_TERM 610find_it $MY_TERM
605if [ $? -ne 0 ];then 611if [ $? -ne 0 ]; then
606 [ -n "$MY_TERM" ] && echo "Warning: you chose an invalid term." >&2 612 [ -n "$MY_TERM" ] && echo "Warning: you chose an invalid term." >&2
607 #The precise order is up for debate. 613 #The precise order is up for debate.
608 for term in Eterm aterm rxvt wterm xterm konsole gnome-terminal; do 614 for term in Eterm aterm rxvt wterm xterm konsole gnome-terminal; do
@@ -618,7 +624,7 @@ fi
618 624
619# find the default browser 625# find the default browser
620find_it $MY_BROWSER 626find_it $MY_BROWSER
621if [ $? -ne 0 ];then 627if [ $? -ne 0 ]; then
622 [ -n "$MY_BROWSER" ] && echo "Warning: you chose an invalid browser." >&2 628 [ -n "$MY_BROWSER" ] && echo "Warning: you chose an invalid browser." >&2
623 #The precise order is up for debate. 629 #The precise order is up for debate.
624 for browser in opera skipstone phoenix mozilla galeon konqueror dillo netscape links w3m lynx; do 630 for browser in opera skipstone phoenix mozilla galeon konqueror dillo netscape links w3m lynx; do
@@ -633,7 +639,7 @@ fi
633 639
634 640
635# a unix system without any terms. that's odd 641# a unix system without any terms. that's odd
636if [ -z "$DEFAULT_TERM" ];then 642if [ -z "$DEFAULT_TERM" ]; then
637 cat <<EOF>&2 643 cat <<EOF>&2
638Warning: I can't find any terminal-emulators in your PATH. 644Warning: I can't find any terminal-emulators in your PATH.
639Please fix your PATH or specify your favourite terminal with the -t option 645Please fix your PATH or specify your favourite terminal with the -t option
@@ -643,10 +649,10 @@ fi
643 649
644# Start of menu 650# Start of menu
645cat << EOF > ${FILENAME} 651cat << EOF > ${FILENAME}
646# Generated by fluxbox-genereate_menu 652# Generated by fluxbox-generate_menu
647# 653#
648# If you read this it means you want to edit this file manualy, so here 654# If you read this it means you want to edit this file manually, so here
649# are some usefull tips: 655# are some useful tips:
650# 656#
651# - You can add your own menu-entries to ~/.fluxbox/usermenu 657# - You can add your own menu-entries to ~/.fluxbox/usermenu
652# 658#
@@ -778,7 +784,7 @@ append_menu_end
778if [ -d ${GPKGDATADIR}/gnome/apps -a "${GNOMEMENU}" ]; then 784if [ -d ${GPKGDATADIR}/gnome/apps -a "${GNOMEMENU}" ]; then
779 append_submenu "${GNOMEMENUTEXT}" 785 append_submenu "${GNOMEMENUTEXT}"
780 for a in `ls ${GPKGDATADIR}/gnome/apps/` ; do 786 for a in `ls ${GPKGDATADIR}/gnome/apps/` ; do
781 if [ -d ${GPKGDATADIR}/gnome/apps/"${a}" ] ; then 787 if [ -d ${GPKGDATADIR}/gnome/apps/"${a}" ]; then
782 append_submenu "${a}" 788 append_submenu "${a}"
783 menu_entry_dir "${GPKGDATADIR}/gnome/apps/${a}" 789 menu_entry_dir "${GPKGDATADIR}/gnome/apps/${a}"
784 menu_entry_dircheck "/etc/X11/applnk/${a}" 790 menu_entry_dircheck "/etc/X11/applnk/${a}"
@@ -810,7 +816,7 @@ if [ -d ${KPKGDATADIR}/applnk/ -a "${KDEMENU}" ]; then
810fi 816fi
811 817
812#User menu 818#User menu
813if [ -r "${USERMENU}" ];then 819if [ -r "${USERMENU}" ]; then
814 cat ${USERMENU} >> ${FILENAME} 820 cat ${USERMENU} >> ${FILENAME}
815fi 821fi
816 822
@@ -826,14 +832,14 @@ append_submenu "${FBSETTINGSMENU}"
826 append_menu_end 832 append_menu_end
827 833
828 # Backgroundmenu 834 # Backgroundmenu
829 if [ "$BACKGROUNDMENUITEM" = "yes" ];then 835 if [ "$BACKGROUNDMENUITEM" = "yes" ]; then
830 append_menu "[submenu] (${BACKGROUNDMENU}) {${BACKGROUNDMENUTITLE}}" 836 append_menu "[submenu] (${BACKGROUNDMENU}) {${BACKGROUNDMENUTITLE}}"
831 if [ `ls -1 ${HOME}/.fluxbox/backgrounds 2>/dev/null |wc -l` -gt 30 ]; then 837 if [ `ls -1 ${HOME}/.fluxbox/backgrounds 2>/dev/null |wc -l` -gt 30 ]; then
832 menucounter=1 ; counter=1 838 menucounter=1 ; counter=1
833 append_menu "[submenu] (${BACKGROUNDMENU} $menucounter) {${BACKGROUNDMENUTITLE}}" 839 append_menu "[submenu] (${BACKGROUNDMENU} $menucounter) {${BACKGROUNDMENUTITLE}}"
834 for i in ${HOME}/.fluxbox/backgrounds/* ${PKGDATADIR}/fluxbox/backgrounds/* ; do 840 for i in ${HOME}/.fluxbox/backgrounds/* ${PKGDATADIR}/fluxbox/backgrounds/* ; do
835 counter=`expr $counter + 1` 841 counter=`expr $counter + 1`
836 if [ $counter -eq 30 ];then 842 if [ $counter -eq 30 ]; then
837 counter=1 843 counter=1
838 menucounter=`expr $menucounter + 1` 844 menucounter=`expr $menucounter + 1`
839 append_menu_end 845 append_menu_end
@@ -876,7 +882,7 @@ append_menu_end
876# this function removes empty menu items. It can not yet remove nested 882# this function removes empty menu items. It can not yet remove nested
877# empty submenus :\ 883# empty submenus :\
878 884
879if [ ! "${REMOVE}" ];then 885if [ ! "${REMOVE}" ]; then
880 clean_up 886 clean_up
881fi 887fi
882 888