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