applied patch from Han

This commit is contained in:
fluxgen 2002-10-19 14:34:08 +00:00
parent 5e5dc14ea9
commit 475e2c09fe

View file

@ -20,50 +20,59 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE. # DEALINGS IN THE SOFTWARE.
# Functions PATH=/bin:/usr/bin/:/usr/local/bin:/usr/X11R6/bin
# Functions
display_usage() { display_usage() {
echo cat <<EOF
echo "fluxbox-generate_menu"
echo 'Usage: fluxbox-generate_menu [-kg] [-o /path]' fluxbox-genrate_menu
echo ' [-p /path] [-m menu-title]' Usage: fluxbox-generate_menu [-kg] [-o /path]
echo "Options:" [-p /path] [-m menu-title]
echo " -k Insert a kde menu" Options:
echo " -g Add a gnome menu"
echo " -p Package-datadir; default is /usr/local/share" -t Favourite terminal.
echo " -o Outputfile; default is ~/.fluxbox/menu" -k Insert a kde menu
echo ' -m Menu-title; default is "Fluxbox"' -g Add a gnome menu
echo " -h Display this help" -o Outputfile; default is ~/.fluxbox/menu
echo " -a Display the authors of this script" -m Menu-title; default is "Fluxbox"
echo
-h Display this help
-a Display the authors of this script
only for packagers:
-p Package-datadir; default is /usr/local/share
EOF
} }
display_help() { display_help() {
echo cat <<EOF
echo "This program generates a menu-file for fluxbox."
echo "Use fluxbox-generate_menu -h for brief usage instructions" This program generates a menu-file for fluxbox.
echo Use fluxbox-generate_menu -h for brief usage instructions
EOF
} }
display_authors() { display_authors() {
echo cat <<EOF
echo "This program was brought to you by:"
echo fluxbox-generate_menu was brought to you by:
echo "Henrik Kinnunnen: Project leader." Henrik Kinnunnen: Project leader.
echo "Han Boetes: Packaging, debugging and scripts." Han Boetes: Packaging, debugging and scripts.
echo "Jeramy B. Smith: Packaging assistance, gnome and kde menu system." Jeramy B. Smith: Packaging assistance, gnome and kde menu system.
echo "Xyrnix: Mysterious guest developer who made find_it module." Xyrnix: Mysterious guest developer who made find_it module.
echo `whoami`": Innocent bystander." filipe: Italian locales and find_term module.
echo EOF
echo -e `whoami`": Innocent bystander.\n"
} }
find_it() { find_it() {
which $1 > /dev/null 2> /dev/null && shift && $* which $1 > /dev/null 2> /dev/null && shift && $*
} }
find_term() {
if find_it $1; then DEFAULT_TERM=$1; fi
}
append() { append() {
echo " $*" >> ${FILENAME} echo " $*" >> ${FILENAME}
} }
@ -100,10 +109,11 @@ menu_entry_dir() {
} }
# Get options. # Get options.
while getopts ":khagp:o:m:" COMMAND_LINE_ARGUMENT ; do while getopts ":khagt:p:o:m:" COMMAND_LINE_ARGUMENT ; do
case "${COMMAND_LINE_ARGUMENT}" in case "${COMMAND_LINE_ARGUMENT}" in
k) KDEMENU=yes ;; k) KDEMENU=yes ;;
g) GNOMEMENU=yes ;; g) GNOMEMENU=yes ;;
t) MY_TERM=${OPTARG};;
o) FILENAME=${OPTARG} ;; o) FILENAME=${OPTARG} ;;
p) PKGDATADIR=${OPTARG} ;; p) PKGDATADIR=${OPTARG} ;;
m) MENUTITLE=${OPTARG} ;; m) MENUTITLE=${OPTARG} ;;
@ -137,24 +147,40 @@ if [ -z "${MENUTITLE}" ]; then
MENUTITLE="Fluxbox" MENUTITLE="Fluxbox"
fi fi
if find_it xterm; then # find the default terminal
DEFAULT_TERM=xterm find_it $MY_TERM
else if [ $? -ne 0 ];then
for term in konsole gnome-terminal Eterm wterm aterm rxvt; do [ -n "$MY_TERM" ] && echo "Warning: you choose an invalid term." > /dev/stderr
find_term $term #The precise order is up for debate.
if [ -nz $DEFAULT_TERM ]; then for term in Eterm aterm rxvt wterm xterm konsole gnome-terminal; do
if find_it $term; then
DEFAULT_TERM=$term
break break
fi fi
done done
else
DEFAULT_TERM=$MY_TERM
fi fi
# a unix system without any terms. that's odd
if [ -z "$DEFAULT_TERM" ];then
cat <<EOF
Error: I can't find any terminal-emulators in your path.
Please specify your favourite terminal with the -t option.
EOF
exit 1
fi
# menu defaults (if translation forget to set one of them) # menu defaults (if translation forget to set one of them)
BROWSERMENU="Browsers" BROWSERMENU="Browsers"
EDITORMENU="Editors" EDITORMENU="Editors"
NETMENU="Net" NETMENU="Net"
GRAPHICMENU="Graphics" GRAPHICMENU="Graphics"
MUSICMENU="Music" MUSICMENU="Music"
TERMINALMENU="Terminals" DEFAULT_TERMINALMENU="Terminals"
MISCMENU="Misc" MISCMENU="Misc"
XUTILSMENU="X-utils" XUTILSMENU="X-utils"
FBSETTINGSMENU="FB-Settings" FBSETTINGSMENU="FB-Settings"
@ -176,7 +202,7 @@ case ${LC_ALL} in
NETMENU="óÅÔØ" NETMENU="óÅÔØ"
GRAPHICMENU="çÒÁÆÉËÁ" GRAPHICMENU="çÒÁÆÉËÁ"
MUSICMENU="ú×ÕË" MUSICMENU="ú×ÕË"
TERMINALMENU="ôÅÒÍÉÎÁÌÙ" DEFAULT_TERMINALMENU="ôÅÒÍÉÎÁÌÙ"
MISCMENU="ðÒÏÞÅÅ" MISCMENU="ðÒÏÞÅÅ"
XUTILSMENU="X-ÕÔÉÌÉÔÙ" XUTILSMENU="X-ÕÔÉÌÉÔÙ"
FBSETTINGSMENU="FB-ÎÁÓÔÒÏÊËÉ" FBSETTINGSMENU="FB-ÎÁÓÔÒÏÊËÉ"
@ -196,7 +222,7 @@ case ${LC_ALL} in
NETMENU="Net" NETMENU="Net"
GRAPHICMENU="Grafik" GRAPHICMENU="Grafik"
MUSICMENU="Musik" MUSICMENU="Musik"
TERMINALMENU="Terminaler" DEFAULT_TERMINALMENU="Terminaler"
MISCMENU="Blandat" MISCMENU="Blandat"
XUTILSMENU="X-program" XUTILSMENU="X-program"
FBSETTINGSMENU="FB-inställningar" FBSETTINGSMENU="FB-inställningar"
@ -216,7 +242,7 @@ case ${LC_ALL} in
NETMENU="Net" NETMENU="Net"
GRAPHICMENU="Grafisch" GRAPHICMENU="Grafisch"
MUSICMENU="Muziek" MUSICMENU="Muziek"
TERMINALMENU="Terminals" DEFAULT_TERMINALMENU="Terminals"
MISCMENU="Onregelmatig" MISCMENU="Onregelmatig"
XUTILSMENU="X-utils" XUTILSMENU="X-utils"
FBSETTINGSMENU="FB-Instellingen" FBSETTINGSMENU="FB-Instellingen"
@ -236,7 +262,7 @@ case ${LC_ALL} in
NETMENU="Verkko" NETMENU="Verkko"
GRAPHICMENU="Grafiikka" GRAPHICMENU="Grafiikka"
MUSICMENU="Musikki" MUSICMENU="Musikki"
TERMINALMENU="Terminaalit" DEFAULT_TERMINALMENU="Terminaalit"
MISCMENU="Sekalaista" MISCMENU="Sekalaista"
XUTILSMENU="X-Ohjelmat" XUTILSMENU="X-Ohjelmat"
FBSETTINGSMENU="FB:n Asetukset" FBSETTINGSMENU="FB:n Asetukset"
@ -256,7 +282,7 @@ case ${LC_ALL} in
NETMENU="¥Í¥Ã¥È¥ï¡¼¥¯" NETMENU="¥Í¥Ã¥È¥ï¡¼¥¯"
GRAPHICMENU="²èÁü" GRAPHICMENU="²èÁü"
MUSICMENU="²»³Ú" MUSICMENU="²»³Ú"
TERMINALMENU="¥¿¡¼¥ß¥Ê¥ë" DEFAULT_TERMINALMENU="¥¿¡¼¥ß¥Ê¥ë"
MISCMENU="¤¤¤í¤¤¤í" MISCMENU="¤¤¤í¤¤¤í"
XUTILSMENU="X¥æ¡¼¥Æ¥£¥ê¥Æ¥£" XUTILSMENU="X¥æ¡¼¥Æ¥£¥ê¥Æ¥£"
FBSETTINGSMENU="FluxboxÀßÄê" FBSETTINGSMENU="FluxboxÀßÄê"
@ -276,7 +302,7 @@ case ${LC_ALL} in
NETMENU="Net" NETMENU="Net"
GRAPHICMENU="Graphisme" GRAPHICMENU="Graphisme"
MUSICMENU="Musique" MUSICMENU="Musique"
TERMINALMENU="Terminaux" DEFAULT_TERMINALMENU="Terminaux"
MISCMENU="Misc" MISCMENU="Misc"
XUTILSMENU="X-utils" XUTILSMENU="X-utils"
FBSETTINGSMENU="FB-Settings" FBSETTINGSMENU="FB-Settings"
@ -296,7 +322,7 @@ case ${LC_ALL} in
NETMENU="Internet" NETMENU="Internet"
GRAPHICMENU="Grafica" GRAPHICMENU="Grafica"
MUSICMENU="Musica" MUSICMENU="Musica"
TERMINALMENU="Terminali" DEFAULT_TERMINALMENU="Terminali"
MISCMENU="Varie" MISCMENU="Varie"
XUTILSMENU="X-utils" XUTILSMENU="X-utils"
FBSETTINGSMENU="Preferenze" FBSETTINGSMENU="Preferenze"
@ -390,7 +416,7 @@ append_submenu ${MUSICMENU}
find_it grip append "[exec] (grip) {grip}" find_it grip append "[exec] (grip) {grip}"
append_menu_end append_menu_end
append_submenu ${TERMINALMENU} append_submenu ${DEFAULT_TERMINALMENU}
find_it xterm append "[exec] (xterm) {xterm}" find_it xterm append "[exec] (xterm) {xterm}"
find_it gnome-terminal append "[exec] (gnome-terminal) {gnome-terminal}" find_it gnome-terminal append "[exec] (gnome-terminal) {gnome-terminal}"
find_it Eterm append "[exec] (Eterm) {Eterm}" find_it Eterm append "[exec] (Eterm) {Eterm}"
@ -490,6 +516,3 @@ append_menu_end
append "[exit] (${EXITITEM})" append "[exit] (${EXITITEM})"
append_menu_end append_menu_end