1#!/bin/sh
2#
3# generate_menu for Fluxbox
4#
5# Copyright (c) 2005 Dung N. Lam <dnlam@users.sourceforge.net>
6# Copyright (c) 2002-2004 Han Boetes <han@mijncomputer.nl>
7#
8# Permission is hereby granted, free of charge, to any person obtaining a
9# copy of this software and associated documentation files (the "Software"),
10# to deal in the Software without restriction, including without limitation
11# the rights to use, copy, modify, merge, publish, distribute, sublicense,
12# and/or sell copies of the Software, and to permit persons to whom the
13# Software is furnished to do so, subject to the following conditions:
14#
15# The above copyright notice and this permission notice shall be included in
16# all copies or substantial portions of the Software.
17#
18# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
21# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24# DEALINGS IN THE SOFTWARE.
25
26# Portability notes:
27# To guarantee this script works on all platforms that support fluxbox
28# please keep the following restrictions in mind:
29#
30# - don't use [ "a" == "a" ]; use [ "a" = "a" ]    (found with help from FreeBSD user relaxed)
31# - don't use if ! command;, use command; if [ $? -ne 0 ];
32# - don't use [ -e file ] use [ -r file ]
33# - don't use $(), use ``
34# - don't use ~, use ${HOME}
35# - don't use id -u or $UID, use whoami
36# - getopts won't work on all platforms, but the config-file can
37#   compensate for that.
38# - OpenBSD and Solaris grep do not have the -m option
39# - various software like grep/sed/perl may be not present or not
40#   the version you have. for example grep '\W' only works on gnu-grep.
41#   Keep this in mind, use bare basic defaults.
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
44#   other ways.
45
46
47# Functions
48display_usage() {
49    cat << EOF
50Usage: @pkgprefix@fluxbox-generate_menu@pkgsuffix@ [-kgrBh] [-t terminal] [-w url] [-b browser]
51         [-m menu-title] [-o /path] [-u /path] [-p /path] [-n /path] [-q /path]
52         [-d /path ] [-ds] [-i /path] [-is] [-su]
53EOF
54}
55
56display_help() {
57    display_usage
58    cat << EOF
59
60Options:
61
62    -k  Insert a KDE menu
63    -g  Add a Gnome menu
64    -B  Enable backgrounds menu
65    -su Enable sudo commands
66    -r  Don't remove empty menu-entries; for templates
67
68    -d  Other path(s) to recursively search for *.desktop files
69    -ds Wider search for *.desktop files (takes more time)
70    -i  Other path(s) to search for icons
71        e.g., "/usr/local/share/icons/crystalsvg/16x16/*"
72    -is Wider search for icons (worth the extra time)
73    -in Skip icon search
74
75    -t  Favourite terminal
76    -w  Homepage for console-browsers. Default is fluxbox.org
77    -b  Favourite browser
78    -m  Menu-title; default is "Fluxbox"
79    -o  Outputfile; default is ~/.@pkgprefix@fluxbox@pkgsuffix@/menu
80    -u  User sub-menu; default is ~/.@pkgprefix@fluxbox@pkgsuffix@/usermenu
81
82    -h  Display this help
83    -a  Display the authors of this script
84
85  Only for packagers:
86
87    -p  Prefix; default is @PREFIX@
88    -n  Gnome-prefix; /usr/local autodetected
89    -q  KDE-prefix; idem dito
90
91
92Files:
93    ~/.@pkgprefix@fluxbox@pkgsuffix@/usermenu     Your own submenu which will be included in the menu
94    ~/.@pkgprefix@fluxbox@pkgsuffix@/menuconfig   rc file for fluxbox-generate_menu
95
96EOF
97}
98
99#'
100display_authors() {
101    cat << EOF
102
103@pkgprefix@fluxbox-generate_menu@pkgsuffix@ was brought to you by:
104
105    Henrik Kinnunen:    Project leader.
106    Han Boetes:         Packaging, debugging and scripts.
107    Simon Bowden:       Cleanups and compatibility for SUN.
108    Jeramy B. Smith:    Packaging assistance, Gnome and KDE menu system.
109    Filippo Pappalardo: Italian locales and -t option.
110    $WHOAMI:            Innocent bystander.
111
112EOF
113}
114
115testoption() {
116    if [ -z "$3" -o -n "`echo $3|grep '^-'`" ]; then
117        echo "Error: The option $2 requires an argument." >&2
118        exit 1
119    fi
120    case $1 in
121        ex) # executable
122            if find_it "$3"; then
123                :
124            else
125                echo "Error: The option $2 needs an executable as argument, and \`$3' is not." >&2
126            fi
127            ;;
128        di) # directory
129            if [ -d "$3" ]; then
130                :
131            else
132                echo "Error: The option $2 needs a directory as argument, and \`$3' is not." >&2
133            fi
134            ;;
135        fl) # file
136            if [ -r "$3" ]; then
137                :
138            else
139                echo "Error: The option $2 needs a readable file as argument, and \`$3' is not." >&2
140            fi
141            ;;
142        sk) # skip
143            :
144            ;;
145    esac
146}
147
148# some which's have a reliable return code, some don't
149# Lets figure out which which we have.
150if which this_program_does_not_exist-no_really-aA1zZ9 2> /dev/null 1> /dev/null; then
151    # can't rely on return value
152    find_it() {
153        file=`which $1 2> /dev/null`
154        if [ -x "$file" ]; then
155            if [ $# -gt 1 ]; then
156                shift
157                "$@"
158            fi
159            return 0
160        else
161            return 1
162        fi
163    }
164
165    find_it_options() {
166        file=`which $1 2> /dev/null`
167        if [ -x "$file" ]; then
168            return 0
169        else
170            return 1
171        fi
172    }
173
174else
175    # can rely on return value
176    find_it() {
177        which $1 > /dev/null 2>&1 && shift && "$@"
178    }
179
180    find_it_options() {
181        which $1 > /dev/null 2>&1
182    }
183fi
184
185#echo "replaceWithinString: $1, $2, $3" >&2
186#echo ${1//$2/$3} # causes error in BSD even though not used
187replaceWithinString(){
188    echo $1 | awk "{ gsub(/$2/, \"$3\"); print }"
189}
190
191convertIcon(){
192    if [ ! -f "$1" ] ; then
193        echo "Icon file not found: $1" >&2
194        return 1
195    fi
196
197    if [ "$1" = "$2" ]; then
198        # $dnlamVERBOSE "Files are in the same location: $1 = $2" >&2
199        # not really an error; just nothing to do.
200        return 0;
201    fi
202
203    local BASENAME
204    BASENAME="${1##*/}"
205
206    # make sure it is an icon by checking if it has an extension
207    if [ "$BASENAME" = "${BASENAME%%.*}" ]; then
208        # $dnlamVERBOSE "File $1 does not have a filename extention." >&2
209        return 1;
210    fi
211
212    # don't have to convert xpm files
213    case "$1" in
214        *.xpm)
215            echo "$1"
216            return 0;
217        ;;
218    esac
219
220    # may not have to convert png if imlib is enabled
221    if [ "$PNG_ICONS" = "yes" ]; then
222        case "$1" in
223            *.png)
224                echo "$1"
225                return 0;
226            ;;
227        esac
228    fi
229
230    # convert all others icons and save it as xpm format under directory $2
231    entry_icon="$2/${BASENAME%.*}.xpm"
232    if [ -f "${entry_icon}" ]; then
233        : echo "File exists. To overwrite, type: convert \"$1\" \"$entry_icon\"" >&2
234    else
235        if which convert &> /dev/null; then
236            convert "$1" "$entry_icon"
237            # echo convert "$1" , "$entry_icon" >> $ICONMAPPING
238        else
239            echo "Please install ImageMagick's convert utility" >&2
240        fi
241    fi
242    echo "$entry_icon"
243}
244
245removePath(){
246    execname="$1"
247    progname="${execname%% *}"
248    # separate program name and its parameters
249    if [ "$progname" = "$execname" ]; then
250        # no params
251        # remove path from only program name
252        execname="${progname##*/}"
253    else
254        params="${execname#* }"
255        # remove path from only program name
256        execname="${progname##*/} $params"
257    fi
258    echo $execname
259}
260
261doSearchLoop(){
262    for ICONPATH in "$@"; do
263        ## $dnlamVERBOSE ": $ICONPATH" >> $ICONMAPPING
264          [ -d "$ICONPATH" ] || continue
265        #echo -n "."
266        # # $dnlamVERBOSE ":: $ICONPATH/$temp_icon" >> $ICONMAPPING
267        if [ -f "$ICONPATH/$temp_icon" ]; then
268            echo "$ICONPATH/$temp_icon"
269            return 0;
270        else # try different extensions;
271            # remove extension
272            iconNOext="${temp_icon%%.*}"
273            [ -d "$ICONPATH" ] && for ICONEXT in .xpm .png .gif ; do
274                ## echo "::: $ICONPATH/$iconNOext$ICONEXT" >> $ICONMAPPING
275                realpath=`find "$ICONPATH" -type f -name "$iconNOext$ICONEXT" | head -n 1`
276                if [ -n "$realpath" ]; then
277                    echo $realpath
278                    return 0;
279                fi
280            done
281        fi
282    done
283    #echo "done"
284    return 1
285}
286
287doSearch(){
288    # remove '(' from '(fluxbox ...) | ...'
289    execname=`replaceWithinString "$1" "\("`
290    temp_icon="$2"
291    # $dnlamVERBOSE "# Searching for icon $temp_icon for $execname" >> $ICONMAPPING
292
293    # check in $ICONMAPPING before searching directories
294    entry_icon=`grep "^\"${execname}\"" $ICONMAPPING | head -n 1 | grep -o '<.*>'`
295    if [ -n "$entry_icon" ]; then
296        entry_icon=`replaceWithinString "$entry_icon" "<"`
297        entry_icon=`replaceWithinString "$entry_icon" ">"`
298        echo $entry_icon
299        return 0;
300    fi
301    # echo "$ICONMAPPING for $execname: $entry_icon"
302
303    # the following paths include a user-defined variable, listing paths to search for icons
304    # echo -n "for $temp_icon"
305    eval doSearchLoop $USER_ICONPATHS \
306      "$FB_ICONDIR" \
307      "/usr/local/share/${execname%% *}" \
308      ${OTHER_ICONPATHS} \
309
310
311}
312
313searchForIcon(){
314    # remove '&' and everything after it
315    entry_exec="${1%%&*}"
316    entry_icon="$2"
317    # $dnlamVERBOSE echo "searchForIcon \"$entry_exec\" \"$entry_icon\"" >&2
318
319    # get the basename and parameters of entry_exec -- no path
320    entry_exec=`removePath "${entry_exec}"`
321    [ -z "$entry_exec" ] && { echo "Exec is NULL $1 with icon $2"; return 1; }
322
323    # search for specified icon if it does not exists
324    if [ -n "$entry_icon" ] && [ ! "$entry_exec" = "$entry_icon" ] && [ ! -f "$entry_icon" ]; then
325        # to search for icon in other paths,
326        # get basename
327        temp_icon="${entry_icon##*/}"
328        # remove parameters
329        temp_icon="${temp_icon#* }"
330        # clear entry_icon until temp_icon is found
331        unset entry_icon
332
333        if [ ! -f "$entry_icon" ]; then
334            entry_icon=`doSearch "$entry_exec" "$temp_icon"`
335        fi
336    fi
337
338    # remove parameters
339    execname="${entry_exec%% *}"
340
341    # echo "search for icon named $execname.{xpm,png,gif}"
342    if [ ! -f "$entry_icon" ]; then
343        entry_icon=`doSearch "$entry_exec" "$execname"`
344    fi
345
346    # -----------  done with search ------------
347    # $dnlamVERBOSE echo "::: $entry_icon" >&2
348
349    # convert icon file, if needed
350    if [ -f "$entry_icon" ] && [ -n "yes$ConvertIfNecessary" ]; then
351        entry_icon=`convertIcon "$entry_icon" "$USERFLUXDIR/icons"`
352        # $dnlamVERBOSE echo ":::: $entry_icon" >&2
353    fi
354
355    # remove path to icon; just get basename
356    icon_base="${entry_icon##*/}"
357    # remove extension
358    icon_base="${icon_base%%.*}"
359    # echo "^.${entry_exec}.[[:space:]]*<.*/${icon_base}\....>"
360    if [ -f "$entry_icon" ]; then
361    # if icon exists and entry does not already exists, add it
362        if ! grep -q -m 1 "^.${execname}.[[:space:]]*<.*/${icon_base}\....>" $ICONMAPPING 2> /dev/null; then
363            printf "\"${execname}\" \t <${entry_icon}>\n" >> $ICONMAPPING
364        else
365            : echo "#    mapping already exists for ${execname}" >> $ICONMAPPING
366        fi
367    else
368        echo "# No icon file found for $execname" >> $ICONMAPPING
369    fi
370}
371
372toSingleLine(){ echo "$@"; }
373createIconMapping(){
374    # $dnlamVERBOSE "# creating `date`" >> $ICONMAPPING
375    # $dnlamVERBOSE "# using desktop files in $@" >> $ICONMAPPING
376    # $dnlamVERBOSE "# searching for icons in `eval toSingleLine $OTHER_ICONPATHS`" >> $ICONMAPPING
377    # need to determine when to use .fluxbox/icons/$execname.xpm over those listed in iconmapping
378    # $dnlamVERBOSE echo "createIconMapping: $@"
379    for DIR in "$@" ; do
380        if [ -d "$DIR" ]; then
381            # $dnlamVERBOSE echo "# ------- Looking in $DIR" >&2
382            # >> $ICONMAPPING
383            find "$DIR" -type f -name "*.desktop" | while read DESKTOP_FILE; do
384                # echo $DESKTOP_FILE;
385                #entry_name=`grep '^[ ]*Name=' $DESKTOP_FILE | head -n 1`
386                #entry_name=${entry_name##*=}
387                entry_exec=`grep '^[ ]*Exec=' "$DESKTOP_FILE" | head -n 1`
388                entry_exec=${entry_exec##*=}
389                entry_exec=`replaceWithinString "$entry_exec" "\""`
390                if [ -z "$entry_exec" ]; then
391                    entry_exec=${DESKTOP_FILE%%.desktop*}
392                fi
393
394                entry_icon=`grep '^[ ]*Icon=' "$DESKTOP_FILE" | head -n 1`
395                entry_icon=${entry_icon##*=}
396
397                # $dnlamVERBOSE echo "--- $entry_exec $entry_icon" >&2
398                case "$entry_icon" in
399                    "" | mime_empty | no_icon )
400                        : echo "no icon for $entry_exec"
401                    ;;
402                    *)
403                        searchForIcon "$entry_exec" "$entry_icon"
404                    ;;
405                esac
406            done
407        fi
408    done
409    # $dnlamVERBOSE "# done `date`" >> $ICONMAPPING
410}
411
412lookupIcon() {
413    if [ ! -f "$ICONMAPPING" ]; then
414        echo "!!! Icon map file not found: $ICONMAPPING" >&2
415        return 1
416    fi
417
418    execname="$1"
419    shift
420    [ -n "$1" ] && echo "!! Ignoring extra parameters: $*" >&2
421
422    [ -z "$execname" ] && { echo "execname is NULL; cannot lookup"; return 1; }
423    execname=`removePath "$execname"`
424
425    #echo "grepping ${execname}"
426    iconString=`grep "^\"${execname}\"" $ICONMAPPING | head -n 1 | grep -o '<.*>'`
427    # $dnlamVERBOSE "lookupIcon $execname, $iconString" >&2
428
429    if [ -z "$iconString" ] ; then
430        iconString=`grep "^\"${execname%% *}" $ICONMAPPING | head -n 1 | grep -o '<.*>'`
431    fi
432
433    if [ -z "$iconString" ] && [ -z "$PARSING_DESKTOP" ] ; then
434        ## $dnlamVERBOSE "lookupIcon: Searching ...  should only be needed for icons not gotten from *.desktop (manual-created ones): $execname" >&2
435        searchForIcon "$execname" "$execname"
436        [ -n "$entry_icon" ] && iconString="<$entry_icon>"
437    fi
438
439    # [ -n "$iconString" ] && echo "  Found icon for $execname: $iconString" >&2
440    echo $iconString
441}
442
443append() {
444     if [ -z "${INSTALL}" ]; then
445        # $dnlamVERBOSE echo "append: $*" >&2
446        iconString="`echo $* | grep -o '<.*>'`"
447        # echo "iconString=$iconString" >&2
448        if [ -z "$iconString" ] && [ -z "$NO_ICON" ]; then
449            echo -n "      $* " >> ${MENUFILENAME}
450            # get the program name between '{}' from parameters
451            execname="$*"
452            execname=${execname#*\{}
453            execname=${execname%%\}*}
454            # $dnlamVERBOSE echo "execname=$execname" >&2
455            # if execname hasn't changed from original $*, then no '{...}' was given
456            if [ ! "$execname" = "$*" ]; then
457                case "$execname" in
458                    $DEFAULT_TERM*)
459                        # remove quotes
460                        execname=`replaceWithinString "$execname" "\""`
461                        # remove "$DEFAULT_TERM -e "
462                        # needed in case calling another program (e.g., vi) via "xterm -e"
463                        execname=${execname##*$DEFAULT_TERM -e }
464                    ;;
465                esac
466                # lookup execname in icon map file
467                iconString=`lookupIcon "$execname"`
468                #[ -n "$iconString" ] || echo "No icon found for $execname"
469            fi
470            echo "${iconString}" >> ${MENUFILENAME}
471        else
472            echo "      $*" >> ${MENUFILENAME}
473        fi
474    else
475        echo "      $*" >> ${MENUFILENAME}
476    fi
477}
478
479append_menu() {
480    echo "$*" >> ${MENUFILENAME}
481}
482
483append_submenu() {
484    [ "${REMOVE}" ] && echo >> ${MENUFILENAME} # only an empty line in templates
485    append_menu "[submenu] ($1)"
486}
487
488append_menu_end() {
489    append_menu '[end]'
490    [ "${REMOVE}" ] && echo >> ${MENUFILENAME} # only an empty line in templates
491}
492
493menu_entry() {
494    if [ -f "$1" ]; then
495        #                   space&tab here
496        entry_name=`grep '^[     ]*Name=' "$1" | head -n 1 | cut -d = -f 2`
497        entry_exec=`grep '^[     ]*Exec=' "$1" | head -n 1 | cut -d = -f 2`
498        if [ -n "$entry_name" -a -n "$entry_exec" ]; then
499            append "[exec] ($entry_name) {$entry_exec}"
500        fi
501    fi
502}
503
504menu_entry_dir() {
505    for b in  "$*"/*.desktop; do
506        menu_entry "${b}"
507    done
508}
509
510menu_entry_dircheck() {
511    if [ -d "$*" ]; then
512        menu_entry_dir "$*"
513    fi
514}
515
516
517# recursively build a menu from the listed directories
518# the dirs are merged
519recurse_dir_menu () {
520    ls "$@"/ 2>/dev/null | sort | uniq | while read name; do
521        for dir in "$@"; do
522            if [ -n "$name" -a -d "$dir/$name" ]; then
523                # recurse
524                append_submenu "${name}"
525                # unfortunately, this is messy since we can't easily expand
526                # them all. Only allow for 3 atm. Add more if needed
527                recurse_dir_menu ${1:+"$1/$name"}  ${2:+"$2/$name"} ${3:+"$3/$name"}
528                append_menu_end
529                break; # found one, it'll pick up all the rest
530            fi
531            # ignore it if it is a file, since menu_entry_dir picks those up
532        done
533    done
534
535    # Make entries for current dir after all submenus
536    for dir in "$@"; do
537        menu_entry_dircheck "${dir}"
538    done
539}
540
541
542normal_find() {
543    while [ "$1" ]; do
544        find_it $1     append "[exec]   ($1) {$1}"
545        shift
546    done
547}
548
549cli_find() {
550    while [ "$1" ]; do
551        find_it $1     append "[exec]   ($1) {${DEFAULT_TERM} -e $1}"
552        shift
553    done
554}
555
556sudo_find() {
557    [ "${DOSUDO}" = yes ] || return
558    while [ "$1" ]; do
559        find_it $1     append "[exec]   ($1 (as root)) {${DEFAULT_TERM} -e sudo $1}"
560        shift
561    done
562}
563
564clean_up() {
565[ -f "$ICONMAPPING" ] && rm -f "$ICONMAPPING"
566
567# Some magic to clean up empty menus
568rm -f ${MENUFILENAME}.tmp
569touch ${MENUFILENAME}.tmp
570counter=10 # prevent looping in odd circumstances
571until [ $counter -lt 1 ] || \
572    cmp ${MENUFILENAME} ${MENUFILENAME}.tmp >/dev/null 2>&1; do
573    [ -s ${MENUFILENAME}.tmp ] && mv ${MENUFILENAME}.tmp ${MENUFILENAME}
574    counter=`expr $counter - 1`
575    grep -v '^$' ${MENUFILENAME}|sed -e "/^\[submenu].*/{
576n
577N
578/^\[submenu].*\n\[end]/d
579}"|sed -e "/^\[submenu].*/{
580N
581/^\[submenu].*\n\[end]/d
582}" > ${MENUFILENAME}.tmp
583done
584rm -f ${MENUFILENAME}.tmp
585}
586# End functions
587
588
589WHOAMI=`whoami`
590[ "$WHOAMI" = root ] && PATH=/bin:/usr/bin:/usr/local/bin
591
592# Check for Imlib2-support
593if @pkgprefix@fluxbox@pkgsuffix@@EXEEXT@ -info 2> /dev/null | grep -q "^IMLIB"; then
594    PNG_ICONS="yes"
595else
596    # better assume to assume "no"
597    PNG_ICONS="no"
598fi
599
600# menu defaults (if translation forget to set one of them)
601
602MENU_ENCODING=UTF-8 # (its also ascii)
603
604ABOUTITEM='About'
605ANALYZERMENU='Analyzers'
606BACKGROUNDMENU='Backgrounds'
607BACKGROUNDMENUTITLE='Set the Background'
608BROWSERMENU='Browsers'
609BURNINGMENU='Burning'
610CONFIGUREMENU='Configure'
611EDITORMENU='Editors'
612EDUCATIONMENU='Education'
613EXITITEM='Exit'
614FBSETTINGSMENU='Fluxbox menu'
615FILEUTILSMENU='File utils'
616FLUXBOXCOMMAND='Fluxbox Command'
617GAMESMENU='Games'
618GNOMEMENUTEXT='Gnome-menus'
619GRAPHICMENU='Graphics'
620KDEMENUTEXT='KDE-menus'
621LOCKSCREEN='Lock screen'
622MISCMENU='Misc'
623MULTIMEDIAMENU='Multimedia'
624MUSICMENU='Audio'
625NETMENU='Net'
626NEWS='News'
627OFFICEMENU='Office'
628RANDOMBACKGROUND='Random Background'
629REGENERATEMENU='Regen Menu'
630RELOADITEM='Reload config'
631RESTARTITEM='Restart'
632RUNCOMMAND='Run'
633SCREENSHOT='Screenshot'
634STYLEMENUTITLE='Choose a style...'
635SYSTEMSTYLES='System Styles'
636SYSTEMTOOLSMENU='System Tools'
637TERMINALMENU='Terminals'
638TOOLS='Tools'
639USERSTYLES='User Styles'
640VIDEOMENU='Video'
641WINDOWMANAGERS='Window Managers'
642WINDOWNAME='Window name'
643WORKSPACEMENU='Workspace List'
644XUTILSMENU='X-utils'
645
646# Check translation
647case ${LC_ALL} in
648    ru_RU*) #Russian locales
649
650# Ah my Russian hero. Please help me update the translation
651# $ cp fluxbox-generate-menu.in fluxbox-generate-menu.in.orig
652# $ $EDITOR fluxbox-generate-menu.in
653# $ diff -u fluxbox-generate-menu.in.orig fluxbox-generate-menu.in > fbgm.diff
654# email fbgm.diff to han@mijncomputer.nl
655
656        MENU_ENCODING=KOI8-R
657
658        BACKGROUNDMENU='����'
659        BACKGROUNDMENUTITLE='���������� ����'
660        BROWSERMENU='��������'
661        CONFIGUREMENU='���������'
662        EDITORMENU='���������'
663        EXITITEM='�����'
664        FBSETTINGSMENU='FB-���������'
665        FILEUTILSMENU='�������� �������'
666        FLUXBOXCOMMAND='��������� �������'
667        GAMESMENU='����'
668        GNOMEMENUTEXT='Gnome-����'
669        GRAPHICMENU='�������'
670        KDEMENUTEXT='KDE-����'
671        LOCKSCREEN='������������� �����'
672        MISCMENU='������'
673        MUSICMENU='����'
674        NETMENU='����'
675        OFFICEMENU='������� ����������'
676        RANDOMBACKGROUND='��������� ����'
677        REGENERATEMENU='������� ���� ������'
678        RELOADITEM='�������������'
679        RESTARTITEM='�������������'
680        RUNCOMMAND='���������'
681        SCREENSHOT='������ ������'
682        STYLEMENUTITLE='�������� �����'
683        SYSTEMSTYLES='��������� �����'
684        TERMINALMENU='���������'
685        TOOLS='�������'
686        USERSTYLES='���������������� �����'
687        WINDOWMANAGERS='��������� ����'
688        WINDOWNAME='��� ����'
689        WORKSPACEMENU='������� ������������'
690        XUTILSMENU='X-�������'
691        ;;
692
693    cs_CZ.ISO*) # Czech locales (ISO-8859-2 encodings)
694
695        MENU_ENCODING=ISO-8859-2
696
697        ABOUTITEM='O programu...'
698        BACKGROUNDMENU='Pozad�'
699        BACKGROUNDMENUTITLE='Nastaven� pozad�'
700        BROWSERMENU='Prohl�e�e'
701        BURNINGMENU='Vypalov�n�'
702        CONFIGUREMENU='Konfigurace'
703        EDITORMENU='Editory'
704        EXITITEM='Ukon�it'
705        FBSETTINGSMENU='Fluxbox Menu'
706        FILEUTILSMENU='Souborov� utility'
707        FLUXBOXCOMMAND='P��kaz Fluxboxu'
708        GAMESMENU='Hry'
709        GNOMEMENUTEXT='Gnome-menu'
710        GRAPHICMENU='Grafika'
711        KDEMENUTEXT='KDE-menu'
712        LOCKSCREEN='Zamknout obrazovku'
713        MISCMENU='R�zn�'
714        MULTIMEDIAMENU='Multim�dia'
715        MUSICMENU='Audio'
716        NETMENU='Internet'
717        NEWS='News'
718        OFFICEMENU='Kancel��'
719        RANDOMBACKGROUND='N�hodn� pozad�'
720        REGENERATEMENU='Obnoven� menu'
721        RELOADITEM='Obnoven� konfigurace'
722        RESTARTITEM='Restart'
723        RUNCOMMAND='Spustit program...'
724        SCREENSHOT='Screenshot'
725        STYLEMENUTITLE='Volba stylu...'
726        SYSTEMTOOLSMENU='Syst�mov� utility'
727        SYSTEMSTYLES='Syst�mov� styly'
728        TERMINALMENU='Termin�ly'
729        TOOLS='N�stroje'
730        USERSTYLES='U�ivatelsk� styly'
731        VIDEOMENU='Video'
732        WINDOWMANAGERS='Okenn� mana�ery'
733        WINDOWNAME='Jm�no okna'
734        WORKSPACEMENU='Seznam ploch'
735        XUTILSMENU='X-utility'
736        ;;
737
738    de_DE*) # german locales
739
740        MENU_ENCODING=ISO-8859-15
741
742        BACKGROUNDMENU='Hintergrundbilder'
743        BACKGROUNDMENUTITLE='Hintergrundbild setzen'
744        BROWSERMENU='Internet-Browser'
745        CONFIGUREMENU='Einstellungen'
746        EDITORMENU='Editoren'
747        EXITITEM='Beenden'
748        FBSETTINGSMENU='Fluxbox-Einstellungen'
749        FILEUTILSMENU='Datei-Utilities'
750        FLUXBOXCOMMAND='Fluxbox Befehl'
751        GAMESMENU='Spiele'
752        GNOMEMENUTEXT='Gnome-Menues'
753        GRAPHICMENU='Grafik'
754        KDEMENUTEXT='Kde-Menues'
755        LOCKSCREEN='Bildschirmsperre'
756        MISCMENU='Sonstiges'
757        MUSICMENU='Musik'
758        NETMENU='Netzwerk'
759        OFFICEMENU='Bueroprogramme'
760        RANDOMBACKGROUND='Zufaelliger Hintergrund'
761        REGENERATEMENU='Menu-Regeneration'
762        RELOADITEM='Konfiguration neu laden'
763        RESTARTITEM='Neustarten'
764        RUNCOMMAND='Ausf�hren'
765        SCREENSHOT='Bildschirmfoto'
766        STYLEMENUTITLE='Einen Stil auswaehlen...'
767        SYSTEMSTYLES='Systemweite Stile'
768        TERMINALMENU='Terminals'
769        TOOLS='Helfer'
770        USERSTYLES='Eigene Stile'
771        WINDOWMANAGERS='Window Manager'
772        WINDOWNAME='Window Name'
773        WORKSPACEMENU='Arbeitsflaechenliste'
774        XUTILSMENU='X-Anwendungen'
775        ;;
776    sv_SE*) #Swedish locales
777# Ah my Swedish hero. Please help me update the translation
778# $ cp fluxbox-generate-menu.in fluxbox-generate-menu.in.orig
779# $ $EDITOR fluxbox-generate-menu.in
780# $ diff -u fluxbox-generate-menu.in.orig fluxbox-generate-menu.in > fbgm.diff
781# email fbgm.diff to han@mijncomputer.nl
782
783        MENU_ENCODING=ISO-8859-1
784
785        BACKGROUNDMENU='Bakgrunder'
786        BACKGROUNDMENUTITLE='S�tt bakgrund'
787        BROWSERMENU='Webbl�sare'
788        CONFIGUREMENU='Konfiguration'
789        EDITORMENU='Editorer'
790        EXITITEM='Avsluta'
791        FBSETTINGSMENU='FB-inst�llningar'
792        FILEUTILSMENU='Filverktyg'
793        FLUXBOXCOMMAND='Fluxbox kommando'
794        GAMESMENU='Spel'
795        GNOMEMENUTEXT='Gnome-menyer'
796        GRAPHICMENU='Grafik'
797        KDEMENUTEXT='KDE-menyer'
798        LOCKSCREEN='L�s sk�rm'
799        MISCMENU='Blandat'
800        MULTIMEDIAMENU='Multimedia'
801        MUSICMENU='Musik'
802        NETMENU='Internet'
803        OFFICEMENU='Office'
804        RANDOMBACKGROUND='Slumpm�ssig bakgrund'
805        REGENERATEMENU='Generera meny'
806        RELOADITEM='Ladda om konfig'
807        RESTARTITEM='Starta om'
808        RUNCOMMAND='K�r'
809        SCREENSHOT='Sk�rmdump'
810        STYLEMENUTITLE='V�lj en stil'
811        SYSTEMSTYLES='Stiler'
812        TERMINALMENU='Terminaler'
813        TOOLS='Verktyg'
814        USERSTYLES='Stiler'
815        VIDEOMENU='Video'
816        WINDOWMANAGERS='F�nsterhanterare'
817        WINDOWNAME='F�nsternamn'
818        WORKSPACEMENU='Arbetsytor'
819        XUTILSMENU='X-program'
820        ;;
821    nl_*) #Nederlandse locales
822
823        MENU_ENCODING=ISO-8859-15
824
825        BACKGROUNDMENU='Achtergrond'
826        BACKGROUNDMENUTITLE='Kies een achtergrond'
827        BROWSERMENU='Browsers'
828        CONFIGUREMENU='Instellingen'
829        EDITORMENU='Editors'
830        EXITITEM='Afsluiten'
831        FBSETTINGSMENU='FB-Instellingen'
832        FILEUTILSMENU='Verkenners'
833        FLUXBOXCOMMAND='Fluxbox Commando'
834        GAMESMENU='Spelletjes'
835        GNOMEMENUTEXT='Gnome-menu'
836        GRAPHICMENU='Grafisch'
837        KDEMENUTEXT='KDE-menu'
838        LOCKSCREEN='Scherm op slot'
839        MISCMENU='Onregelmatig'
840        MUSICMENU='Muziek'
841        NETMENU='Internet'
842        OFFICEMENU='Office'
843        RANDOMBACKGROUND='Willekeurige Achtergrond'
844        REGENERATEMENU='Nieuw Menu'
845        RELOADITEM='Vernieuw instellingen'
846        RESTARTITEM='Herstart'
847        RUNCOMMAND='Voer uit'
848        SCREENSHOT='Schermafdruk'
849        STYLEMENUTITLE='Kies een stijl'
850        SYSTEMSTYLES='Systeem Stijlen'
851        TERMINALMENU='Terminals'
852        TOOLS='Gereedschap'
853        USERSTYLES='Gebruikers Stijlen'
854        WINDOWMANAGERS='Venster Managers'
855        WINDOWNAME='Venster Naam'
856        WORKSPACEMENU='Werkveld menu'
857        XUTILSMENU='X-Gereedschap'
858        ;;
859    fi_FI*) #Finnish locales
860
861        MENU_ENCODING=ISO-8859-1
862
863        ABOUTMENU='Tietoja ohjelmasta'
864        ABOUTITEM='Tietoja ohjelmasta'
865        BACKGROUNDMENU='Taustakuvat'
866        BACKGROUNDMENUTITLE='M��rit� taustakuva'
867        BROWSERMENU='Selaimet'
868        CONFIGUREMENU='Asetukset'
869        EDITORMENU='Editorit'
870        EXITITEM='Lopeta'
871        FBSETTINGSMENU='Fluxboxin asetukset'
872        FILEUTILSMENU='Tiedostoty�kalut'
873        FLUXBOXCOMMAND='Fluxbox komentorivi'
874        GAMESMENU='Pelit'
875        GNOMEMENUTEXT='Gnomen valikot'
876        GRAPHICMENU='Grafiikka'
877        KDEMENUTEXT='KDE:n valikot'
878        LOCKSCREEN='Lukitse n�ytt�'
879        MISCMENU='Sekalaista'
880        MUSICMENU='Musiikki'
881        NETMENU='Verkko'
882        OFFICEMENU='Toimisto-ohjelmat'
883        RANDOMBACKGROUND='Satunnainen taustakuva'
884        REGENERATEMENU='P�ivit� valikko'
885        RELOADITEM='P�ivit�'
886        RESTARTITEM='K�ynnist� uudelleen'
887        RUNCOMMAND='Suorita'
888        SCREENSHOT='Kuvakaappaus'
889        STYLEMENUTITLE='Valitse tyyli'
890        SYSTEMSTYLES='J�rjestelm�n tyylit'
891        TERMINALMENU='Terminaalit'
892        TOOLS='Ty�kalut'
893        USERSTYLES='K�ytt�j�n tyylit'
894        WINDOWMANAGERS='Ikkunointiohjelmat'
895        WINDOWNAME='Ikkunan nimi'
896        WORKSPACEMENU='Ty�alueet'
897        XUTILSMENU='X-Ohjelmat'
898        ;;
899    ja_JP*) #Japanese locales
900# Ah my Japanese hero. Please help me update the translation
901# $ cp fluxbox-generate-menu.in fluxbox-generate-menu.in.orig
902# $ $EDITOR fluxbox-generate-menu.in
903# $ diff -u fluxbox-generate-menu.in.orig fluxbox-generate-menu.in > fbgm.diff
904# email fbgm.diff to han@mijncomputer.nl
905
906        MENU_ENCODING=eucJP
907
908        BACKGROUNDMENU='�ط�'
909        BACKGROUNDMENUTITLE='�طʤ�����'
910        BROWSERMENU='�֥饦��'
911        CONFIGUREMENU='����'
912        EDITORMENU='���ǥ���'
913        EXITITEM='��λ'
914        FBSETTINGSMENU='Fluxbox������'
915        FILEUTILSMENU='�ե��������'
916        FLUXBOXCOMMAND='Fluxbox���ޥ��'
917        GAMESMENU='������'
918        GNOMEMENUTEXT='Gnome��˥塼'
919        GRAPHICMENU='����'
920        KDEMENUTEXT='KDE��˥塼'
921        LOCKSCREEN='�����꡼���å�'
922        MISCMENU='������'
923        MUSICMENU='����'
924        NETMENU='�ͥåȥ��'
925        OFFICEMENU='���ե���(Office)'
926        RANDOMBACKGROUND='�ط�(������)'
927        REGENERATEMENU='��˥塼�ƹ���'
928        RELOADITEM='���ɤ߹���'
929        RESTARTITEM='�Ƶ�ư'
930        RUNCOMMAND='���ޥ�ɤμ¹�'
931        SCREENSHOT='�����꡼����å�'
932        STYLEMENUTITLE='������������...'
933        SYSTEMSTYLES='��������'
934        TERMINALMENU='�����ߥʥ�'
935        TOOLS='�ġ���'
936        USERSTYLES='��������'
937        WINDOWMANAGERS='������ɥ��ޥ͡�����'
938        WINDOWNAME='������ɥ�̾'
939        WORKSPACEMENU='������ڡ���'
940        XUTILSMENU='X�桼�ƥ���ƥ�'
941        ;;
942    fr_FR*) # french locales
943# Ah my french hero. Please help me update the translation
944# $ cp fluxbox-generate-menu.in fluxbox-generate-menu.in.orig
945# $ $EDITOR fluxbox-generate-menu.in
946# $ diff -u fluxbox-generate-menu.in.orig fluxbox-generate-menu.in > fbgm.diff
947# email fbgm.diff to han@mijncomputer.nl
948
949        MENU_ENCODING=ISO-8859-15
950
951        ANALYZERMENU='Analyseurs'
952        BACKGROUNDMENU="Fond d'�cran"
953        BACKGROUNDMENUTITLE="Changer le fond d'�cran"
954        BROWSERMENU='Navigateurs'
955        CONFIGUREMENU='Configurer'
956        EDITORMENU='�diteurs'
957        EXITITEM='Sortir'
958        FBSETTINGSMENU='Configurer Fluxbox'
959        FILEUTILSMENU='Outils fichiers'
960        FLUXBOXCOMMAND='Commande Fluxbox'
961        GAMESMENU='Jeux'
962        GNOMEMENUTEXT='Menus Gnome'
963        GRAPHICMENU='Graphisme'
964        KDEMENUTEXT='Menus KDE'
965        LOCKSCREEN="Verrouiller l'�cran"
966        MISCMENU='Divers'
967        MULTIMEDIAMENU='Multim�dia'
968        MUSICMENU='Musique'
969        NETMENU='R�seau'
970        OFFICEMENU='Bureautique'
971        RANDOMBACKGROUND="Fond d'�cran al�atoire"
972        REGENERATEMENU='R�g�n�rer le menu'
973        RELOADITEM='Recharger la configuration'
974        RESTARTITEM='Red�marrer Fluxbox'
975        RUNCOMMAND='Run'
976        SCREENSHOT="Capture d'�cran"
977        STYLEMENUTITLE='Choisir un style...'
978        SYSTEMSTYLES='Styles Syst�me'
979        SYSTEMTOOLSMENU='Outils Syst�me'
980        TERMINALMENU='Terminaux'
981        TOOLS='Outils'
982        USERSTYLES='Styles Utilisateur'
983        VIDEOMENU='Vid�o'
984        WINDOWMANAGERS='Gestionnaires de fen�tres'
985        WINDOWNAME='Nom de la fen�tre'
986        WORKSPACEMENU='Liste des bureaux'
987        XUTILSMENU='Outils X'
988        ;;
989    it_IT*) # italian locales
990
991        MENU_ENCODING=ISO-8859-1
992
993        BACKGROUNDMENU='Sfondi'
994        BACKGROUNDMENUTITLE='Imposta lo sfondo'
995        BROWSERMENU='Browsers'
996        CONFIGUREMENU='Configurazione'
997        EDITORMENU='Editori'
998        EXITITEM='Esci'
999        FBSETTINGSMENU='Preferenze'
1000        FILEUTILSMENU='Utilit�'
1001        FLUXBOXCOMMAND='Comando Fluxbox'
1002        GAMESMENU='Giochi'
1003        GNOMEMENUTEXT='Gnome'
1004        GRAPHICMENU='Grafica'
1005        KDEMENUTEXT='KDE'
1006        LOCKSCREEN='Blocca lo schermo'
1007        MISCMENU='Varie'
1008        MUSICMENU='Musica'
1009        NETMENU='Internet'
1010        OFFICEMENU='Office'
1011        RANDOMBACKGROUND='Sfondo casuale'
1012        REGENERATEMENU='Rigenera il menu'
1013        RELOADITEM='Rileggi la configurazione'
1014        RESTARTITEM='Riavvia'
1015        RUNCOMMAND='Esegui'
1016        SCREENSHOT='Schermata'
1017        STYLEMENUTITLE='Scegli uno stile'
1018        SYSTEMSTYLES='Stile'
1019        TERMINALMENU='Terminali'
1020        TOOLS='Attrezzi'
1021        USERSTYLES='Stile'
1022        WINDOWMANAGERS='Gestori finestre'
1023        WINDOWNAME='Nome della finestra'
1024        WORKSPACEMENU='Aree di lavoro'
1025        XUTILSMENU='Utilit� X'
1026        ;;
1027    ro_RO*) # Romanian locales
1028# Ah my Romanian hero. Please help me update the translation
1029# $ cp fluxbox-generate-menu.in fluxbox-generate-menu.in.orig
1030# $ $EDITOR fluxbox-generate-menu.in
1031# $ diff -u fluxbox-generate-menu.in.orig fluxbox-generate-menu.in > fbgm.diff
1032# email fbgm.diff to han@mijncomputer.nl
1033
1034        MENU_ENCODING=ISO-8859-15
1035
1036        BACKGROUNDMENU='Fundaluri'
1037        BACKGROUNDMENUTITLE='Alege fundalul'
1038        BROWSERMENU='Navigatoare'
1039        CONFIGUREMENU='Configurare'
1040        EDITORMENU='Editoare'
1041        EXITITEM='Iesire'
1042        FBSETTINGSMENU='Meniul Fluxbox'
1043        FILEUTILSMENU='Utilitare de fisier'
1044        FLUXBOXCOMMAND='Comanda Fluxbox'
1045        GAMESMENU='Jocuri'
1046        GNOMEMENUTEXT='Meniu Gnome'
1047        GRAPHICMENU='Grafica'
1048        KDEMENUTEXT='Meniu KDE'
1049        LOCKSCREEN='Incuie ecranul'
1050        MISCMENU='Diverse'
1051        MULTIMEDIAMENU='Multimedia'
1052        MUSICMENU='Muzica'
1053        NETMENU='Retea'
1054        OFFICEMENU='Office'
1055        RANDOMBACKGROUND='Fundal aleator'
1056        REGENERATEMENU='Regenereaza meniul'
1057        RELOADITEM='Reincarca configuratia'
1058        RESTARTITEM='Restart'
1059        RUNCOMMAND='Lanseaza'
1060        SCREENSHOT='Captura ecran'
1061        STYLEMENUTITLE='Alege un stil...'
1062        SYSTEMSTYLES='Stiluri sistem'
1063        TERMINALMENU='Terminale'
1064        TOOLS='Unelte'
1065        USERSTYLES='Stiluri utilizator'
1066        WINDOWMANAGERS='WindowManagers'
1067        WINDOWNAME='Nume fereastra'
1068        WORKSPACEMENU='Lista workspace-uri'
1069        XUTILSMENU='Utilitare X'
1070        ;;
1071    es_ES*) # spanish locales
1072
1073        MENU_ENCODING=ISO-8859-15
1074
1075        ABOUTITEM='Acerca'
1076        BACKGROUNDMENU='Fondos'
1077        BACKGROUNDMENUTITLE='Seleccionar Fondo'
1078        BROWSERMENU='Navegadores'
1079        BURNINGMENU='Herramientas de grabaci�n'
1080        CONFIGUREMENU='Configurar'
1081        EDITORMENU='Editores'
1082        EDUCATIONMENU='Educaci�n'
1083        EXITITEM='Salir'
1084        FBSETTINGSMENU='Men� fluxbox'
1085        FILEUTILSMENU='Utilidades'
1086        FLUXBOXCOMMAND='Comandos de Fluxbox'
1087        GAMESMENU='Juegos'
1088        GNOMEMENUTEXT='Men�s Gnome'
1089        GRAPHICMENU='Gr�ficos'
1090        KDEMENUTEXT='Men�s KDE'
1091        LOCKSCREEN='Bloquear Pantalla'
1092        MISCMENU='Varios'
1093        MULTIMEDIAMENU='Multimedia'
1094        MUSICMENU='M�sica'
1095        NETMENU='Red'
1096        NEWS='Noticias'
1097        OFFICEMENU='Oficina'
1098        RANDOMBACKGROUND='Fondo Aleatoreo'
1099        REGENERATEMENU='Regenerar Men�'
1100        RELOADITEM='Reconfigurar'
1101        RESTARTITEM='Reiniciar'
1102        RUNCOMMAND='Ejecutar'
1103        SCREENSHOT='Captura de Pantalla'
1104        STYLEMENUTITLE='Escoge un Estilo...'
1105        SYSTEMSTYLES='Estilos del Sistema'
1106        TERMINALMENU='Terminales'
1107        TOOLS='Herramienta'
1108        USERSTYLES='Estilos del Usuario'
1109        VIDEOMENU='Video'
1110        WINDOWMANAGERS='Gestores de Ventanas'
1111        WINDOWNAME='Nombre de Ventana'
1112        WORKSPACEMENU='Lista de Escritorios'
1113        XUTILSMENU='Utilidades X'
1114        ;;
1115    pl_PL*) # Polish locales
1116# Ah my Russian hero. Please help me update the translation
1117# $ cp fluxbox-generate-menu.in fluxbox-generate-menu.in.orig
1118# $ $EDITOR fluxbox-generate-menu.in
1119# $ diff -u fluxbox-generate-menu.in.orig fluxbox-generate-menu.in > fbgm.diff
1120# email fbgm.diff to han@mijncomputer.nl
1121
1122        MENU_ENCODING=ISO-8859-2
1123
1124        BACKGROUNDMENU='Tapety'
1125        BACKGROUNDMENUTITLE='Ustaw tapet�'
1126        BROWSERMENU='Przegl�darki'
1127        CONFIGUREMENU='Konfiguracja'
1128        EDITORMENU='Edytory'
1129        EXITITEM='Wyj�cie'
1130        FBSETTINGSMENU='Menu Fluxbox'
1131        FILEUTILSMENU='Narz�dzia do plik�w'
1132        FLUXBOXCOMMAND='Polecenia Fluxbox'
1133        GAMESMENU='Gry'
1134        GNOMEMENUTEXT='Menu Gnome'
1135        GRAPHICMENU='Grafika'
1136        KDEMENUTEXT='Menu KDE'
1137        LOCKSCREEN='Zablokuj ekran'
1138        MISCMENU='R�ne'
1139        MULTIMEDIAMENU='Multimedia'
1140        MUSICMENU='Muzyka'
1141        NETMENU='Sie�'
1142        OFFICEMENU='Aplikacje biurowe'
1143        RANDOMBACKGROUND='Losowa tapeta'
1144        REGENERATEMENU='Wygeneruj menu'
1145        RELOADITEM='Od�wie� konfiguracj�'
1146        RESTARTITEM='Restartuj'
1147        RUNCOMMAND='Uruchom...'
1148        SCREENSHOT='Zrzut ekranu'
1149        STYLEMENUTITLE='Wybierz styl...'
1150        SYSTEMSTYLES='Style systemowe'
1151        TERMINALMENU='Terminale'
1152        TOOLS='Narz�dzia'
1153        USERSTYLES='Style u�ytkownika'
1154        WINDOWMANAGERS='Menad�ery okien'
1155        WINDOWNAME='Nazwy okien'
1156        WORKSPACEMENU='Lista pulpit�w'
1157        XUTILSMENU='Narz�dzia X'
1158        ;;
1159    pt_PT*) # Portuguese locales
1160
1161        MENU_ENCODING=ISO-8859-1
1162
1163        ABOUTMENU="Sobre"
1164        BACKGROUNDMENU='Imagens de Fundo'
1165        BACKGROUNDMENUTITLE='Definir Imagem de Fundo'
1166        BROWSERMENU='Browsers'
1167        BURNINGMENU='Ferramentas de Grava��o'
1168        CONFIGUREMENU='Configura��o'
1169        EDITORMENU='Editores'
1170        EDUCATIONMENU='Educa��o'
1171        EXITITEM='Sair'
1172        FBSETTINGSMENU='Menu Fluxbox'
1173        FILEUTILSMENU='Utilit�rios de Ficheiros'
1174        FLUXBOXCOMMAND='Comando Fluxbox'
1175        GAMESMENU='Jogos'
1176        GNOMEMENUTEXT='Menu Gnome'
1177        GRAPHICMENU='Gr�ficos'
1178        KDEMENUTEXT='Menu KDE'
1179        LOCKSCREEN='Trancar Ecr�'
1180        MISCMENU='Misc.'
1181        MULTIMEDIAMENU='Multim�dia'
1182        MUSICMENU='�udio'
1183        NETMENU='Rede'
1184        NEWS='Not�cias'
1185        OFFICEMENU='Escrit�rio'
1186        RANDOMBACKGROUND='Imagem Aleat�ria'
1187        REGENERATEMENU='Regenerar Menu'
1188        RELOADITEM='Recarregar configura��o'
1189        RESTARTITEM='Reiniciar'
1190        RUNCOMMAND='Executar'
1191        SCREENSHOT='Capturar Ecr�'
1192        STYLEMENUTITLE='Escolha um estilo...'
1193        SYSTEMSTYLES='Estilos do Sistema'
1194        SYSTEMTOOLSMENU='Ferramentas de Sistema'
1195        TERMINALMENU='Terminais'
1196        TOOLS='Ferramentas'
1197        USERSTYLES='Estilos do Utilizador'
1198        VIDEOMENU='V�deo'
1199        WINDOWMANAGERS='Gestores de Janelas'
1200        WINDOWNAME='Nome da Janela'
1201        WORKSPACEMENU='Lista de �reas de Trabalho'
1202        XUTILSMENU='Utilit�rios X'
1203        ;;
1204    nb_NO*) # Norwegian locales
1205
1206        MENU_ENCODING=UTF-8
1207
1208        ABOUTITEM='Om'
1209        BACKGROUNDMENU='Bakgrunner'
1210        BACKGROUNDMENUTITLE='Velg bakgrunn'
1211        BROWSERMENU='Nettlesere'
1212        CONFIGUREMENU='Oppsett'
1213        EDITORMENU='Tekstredigeringsprogram'
1214        EDUCATIONMENU='Lek og lær'
1215        EXITITEM='Avslutt'
1216        FBSETTINGSMENU='FluxBox-meny'
1217        FILEUTILSMENU='Filverktøy'
1218        FLUXBOXCOMMAND='FluxBox-kommando'
1219        GAMESMENU='Spill'
1220        GNOMEMENUTEXT='Gnome-menyer'
1221        GRAPHICMENU='Grafikk'
1222        KDEMENUTEXT='KDE-menyer'
1223        LOCKSCREEN='Lås skjermen'
1224        MISCMENU='Diverse'
1225        MULTIMEDIAMENU='Multimedia'
1226        MUSICMENU='Lyd'
1227        NETMENU='Nett'
1228        NEWS='Nyheter'
1229        OFFICEMENU='Kontor'
1230        RANDOMBACKGROUND='Tilfeldig bakgrunn'
1231        REGENERATEMENU='Regen Menu'
1232        RELOADITEM='Last oppsett på nytt'
1233        RESTARTITEM='Start på nytt'
1234        RUNCOMMAND='Kjør'
1235        SCREENSHOT='Ta bilde'
1236        STYLEMENUTITLE='Velg en stil . . .'
1237        SYSTEMSTYLES='System-stiler'
1238        TERMINALMENU='Terminaler'
1239        TOOLS='Verktøy'
1240        USERSTYLES='Bruker-stiler'
1241        VIDEOMENU='Video'
1242        WINDOWMANAGERS='Vindusbehandlere'
1243        WINDOWNAME='Vindunavn'
1244        WORKSPACEMENU='Liste over arbeidsområder'
1245        XUTILSMENU='X-verktøy'
1246        ;;
1247    *)
1248        ;;
1249esac
1250
1251# Set Defaults
1252USERFLUXDIR="${HOME}/.@pkgprefix@fluxbox@pkgsuffix@"
1253MENUFILENAME="${MENUFILENAME:=${USERFLUXDIR}/menu}"
1254MENUTITLE="${MENUTITLE:=Fluxbox}"
1255HOMEPAGE="${HOMEPAGE:=fluxbox.org}"
1256USERMENU="${USERMENU:=${USERFLUXDIR}/usermenu}"
1257MENUCONFIG="${MENUCONFIG:=${USERFLUXDIR}/menuconfig}"
1258DOSUDO="no"
1259
1260# Read the menuconfig file if it exists or else create it.
1261# But not during install time, use envvar for sun
1262if [ ! "${INSTALL}" = Yes ]; then
1263    if [ -r ${MENUCONFIG} ]; then
1264        . ${MENUCONFIG}
1265    else
1266        if [ ! "$WHOAMI" = root ]; then # this is only for users.
1267            if touch ${MENUCONFIG}; then
1268                cat << EOF > ${MENUCONFIG}
1269# This file is read by fluxbox-generate_menu.  If you don't like a
1270# default you can change it here.  Don't forget to remove the # in front
1271# of the line.
1272
1273# Your favourite terminal. Put the command in quotes if you want to use
1274# options. Put a backslash in before odd chars
1275# MY_TERM='Eterm --tint \#123456'
1276# MY_TERM='aterm -tint \$(random_color)'
1277
1278# Your favourite browser. You can also specify options.
1279# MY_BROWSER=mozilla
1280
1281# Name of the outputfile
1282# MENUFILENAME=${USERFLUXDIR}/menu
1283
1284# MENUTITLE=\`@pkgprefix@fluxbox@pkgsuffix@@EXEEXT@ -version|cut -d " " -f-2\`
1285
1286# standard url for console-browsers
1287# HOMEPAGE=fluxbox.org
1288
1289# location with your own menu-entries
1290# USERMENU=~/.@pkgprefix@fluxbox@pkgsuffix@/usermenu
1291
1292# Put the launcher you would like to use here
1293# LAUNCHER=@pkgprefix@fbrun@pkgsuffix@@EXEEXT@
1294# LAUNCHER=fbgm
1295
1296# Options for fbrun
1297# FBRUNOPTIONS='-font 10x20 -fg grey -bg black -title run'
1298
1299# --- PREFIX'es
1300# These are prefixes; So if fluxbox is installed in @PREFIX@/bin/fluxbox
1301# your prefix is: @PREFIX@
1302
1303# fluxbox-generate already looks in /usr/local so
1304# there should be no need to specify them.
1305#
1306# PREFIX=@PREFIX@
1307# GNOME_PREFIX=/usr/local
1308# KDE_PREFIX=/usr/local
1309
1310
1311# Separate the list of background dirs with colons ':'
1312# BACKGROUND_DIRS="${USERFLUXDIR}/backgrounds/:@PREFIX@/share/fluxbox/backgrounds/:/usr/local/share/wallpapers"
1313
1314
1315# --- Boolean variables.
1316# Setting a variable to ``no'' won't help. Comment them out if you don't
1317# want them. Settings are overruled by the command-line options.
1318
1319# Include all backgrounds in your backgrounds-directory
1320# BACKGROUNDMENUITEM=yes
1321
1322# Include KDE-menus
1323# KDEMENU=yes
1324
1325# Include Gnome-menus
1326# GNOMEMENU=yes
1327
1328# Enable sudo commands
1329# DOSUDO=yes
1330
1331# Don't cleanup the menu
1332# REMOVE=no
1333
1334# Don't add icons to the menu
1335# NO_ICON=yes
1336
1337EOF
1338            else
1339                echo "Warning: I couldn't create ${MENUCONFIG}" >&2
1340            fi
1341        fi
1342    fi
1343fi
1344
1345BACKUPOPTIONS=$@
1346if [ -n "$BACKUPOPTIONS" ]; then
1347    FBGM_CMD="@pkgprefix@fluxbox-generate_menu@pkgsuffix@ $BACKUPOPTIONS"
1348else
1349    FBGM_CMD=@pkgprefix@fluxbox-generate_menu@pkgsuffix@
1350fi
1351# Get options.
1352while [ $# -gt 0 ]; do
1353    case "$1" in
1354        -B) BACKGROUNDMENUITEM=yes; shift;;
1355        -k) KDEMENU=yes; shift;;
1356        -g) GNOMEMENU=yes; shift;;
1357        -in) NO_ICON=yes; shift;;
1358        -is) OTHER_ICONPATHS="
1359                /usr/local/share/icons
1360                /usr/local/share/icons/mini
1361                /usr/local/share/pixmaps
1362                /usr/local/share/xclass/icons
1363                /usr/local/share/xclass/pixmaps
1364                /usr/local/share/icons/default/16x16
1365                /usr/local/share/icons/kde/16x16
1366                /usr/local/share/icons/hicolor/16x16
1367            "
1368            shift;;
1369        -ds) OTHER_DESKTOP_PATHS="
1370                /usr/local/share/mimelnk
1371                /usr/local/share/applications
1372                /usr/local/share/xsessions
1373                /usr/local/share/services
1374            "
1375            # /usr/share/apps \
1376            shift;;
1377        -i) USER_ICONPATHS=${2};
1378            #needs testing
1379            for aPath in $2; do
1380                testoption di $1 $aPath;
1381            done
1382            shift 2;;
1383        -d) USER_DESKTOP_PATHS=${2};
1384            #needs testing
1385            for aPath in $2; do
1386                testoption di $1 $aPath;
1387            done
1388            shift 2;;
1389        -t) MY_TERM=${2}; testoption ex $1 $2; shift 2;;
1390        -b) MY_BROWSER=${2}; testoption ex $1 $2; shift 2;;
1391        -o) MENUFILENAME=${2}; shift 2; CHECKINIT=NO ;;
1392        -p) PREFIX=${2}; testoption di $1 $2; shift 2;;
1393        -n) GNOME_PREFIX=${2}; testoption di $1 $2; shift 2;;
1394        -q) KDE_PREFIX=${2}; testoption di $1 $2; shift 2;;
1395        -m) MENUTITLE=${2}; testoption sk $1 $2; shift 2;;
1396        -w) HOMEPAGE=${2}; testoption sk $1 $2; shift 2;;
1397        -u) USERMENU=${2}; testoption fl $1 $2; shift 2;;
1398	-su) DOSUDO=yes; shift;;
1399        -r) REMOVE=no; shift;;
1400        -h) display_help ; exit 0 ;;
1401        -a) display_authors ; exit 0 ;;
1402        --*) echo "fluxbox-generate_menu doesn't recognize -- gnu-longopts."
1403            echo 'Use fluxbox-generate_menu -h for a long help message.'
1404            display_usage
1405            exit 1 ;;
1406        -[a-zA-Z][a-zA-Z]*)
1407            # split concatenated single-letter options apart
1408            FIRST="$1"; shift
1409            set -- `echo "$FIRST" | sed 's/^-\(.\)\(.*\)/-\1 -\2/'` "$@"
1410            ;;
1411        -*)
1412            echo 1>&2 "fluxbox-generate_menu: unrecognized option "\`"$1'"
1413            display_usage
1414            exit 1
1415            ;;
1416        *)
1417            break
1418            ;;
1419    esac
1420done
1421
1422# Check defaults
1423
1424# Can we actually create ${MENUFILENAME}
1425touch ${MENUFILENAME} 2> /dev/null
1426if [ $? -ne 0 ]; then
1427    echo "Fatal error: can't create or write to $MENUFILENAME" >&2
1428    exit 1
1429fi
1430
1431# backup menu
1432if [ -w "${MENUFILENAME}" ]; then
1433    if [ -f ${MENUFILENAME}.firstbak ]; then
1434        cp ${MENUFILENAME} ${MENUFILENAME}.firstbak
1435    fi
1436    if [ -s "${MENUFILENAME}" ]; then
1437       mv ${MENUFILENAME} ${MENUFILENAME}.bak
1438    fi
1439fi
1440
1441# prefix
1442PREFIX="${PREFIX:=@PREFIX@}"
1443if [  -z "${PREFIX}" -o ! -d "${PREFIX}" ]; then
1444    PREFIX=`which fluxbox | sed 's,/bin/fluxbox$,,'`
1445fi
1446
1447
1448# gnome prefix
1449for GNOME_PREFIX in "${GNOME_PREFIX}" /usr/local "${PREFIX}"; do
1450    if [ -n "${GNOME_PREFIX}" -a -d "$GNOME_PREFIX/share/gnome" ]; then
1451        break;
1452    fi
1453done
1454# Will remain $PREFIX if all else fails
1455
1456# kde prefix
1457for KDE_PREFIX in "${KDE_PREFIX}" /usr/local "${PREFIX}"; do
1458    if [ -n "${KDE_PREFIX}" -a -d "$KDE_PREFIX/share/applnk" ]; then
1459        break;
1460    fi
1461done
1462
1463if [ -z "${INSTALL}" ] && [ -z "${NO_ICON}" ]; then
1464    # [ -z "$dnlamVERBOSE" ] && dnlamVERBOSE=": echo"   # for debugging
1465    FB_ICONDIR="$USERFLUXDIR/icons"
1466    [ -r "$FB_ICONDIR" ] || mkdir "$FB_ICONDIR"
1467    ICONMAPPING="$USERFLUXDIR/iconmapping"
1468
1469    if [ "$GNOMEMENU" ] ; then
1470        OTHER_DESKTOP_PATHS="\"$HOME/.gnome/apps\" \"${GNOME_PREFIX}/share/gnome/apps\" $OTHER_DESKTOP_PATHS"
1471        #[ "OTHER_ICONPATHS" ] && OTHER_ICONPATHS=
1472    fi
1473    if [ "$KDEMENU" ] ; then
1474        OTHER_DESKTOP_PATHS="\"$HOME/.kde/share/applnk\" \"${KDE_PREFIX}/share/applnk\" $OTHER_DESKTOP_PATHS"
1475        [ "OTHER_ICONPATHS" ] && OTHER_ICONPATHS="\"$HOME\"/.kde/share/icons/{,*} $OTHER_ICONPATHS"
1476    fi
1477    [ "$GNOMEMENU$KDEMENU" ] && OTHER_DESKTOP_PATHS="\"$ETCAPPLNK\" $OTHER_DESKTOP_PATHS"
1478
1479    checkDirs(){
1480        #echo checkDirs: $* >&2
1481        local CHECKED_DIRS=""
1482        for DIR in "$@"; do
1483            if [ -d "$DIR" ]; then
1484                # todo: should check if there are duplicates
1485                CHECKED_DIRS="$CHECKED_DIRS \"$DIR\""
1486            fi
1487        done
1488        #echo checkDirs - $CHECKED_DIRS >&2
1489        echo $CHECKED_DIRS
1490    }
1491
1492    OTHER_ICONPATHS=`eval checkDirs $OTHER_ICONPATHS`
1493    OTHER_DESKTOP_PATHS=`eval checkDirs $OTHER_DESKTOP_PATHS`
1494
1495    # $dnlamVERBOSE "Using USER_DESKTOP_PATHS=\"$USER_DESKTOP_PATHS\" and USER_ICONPATHS=\"$USER_ICONPATHS\""
1496    # $dnlamVERBOSE "Using OTHER_ICONPATHS=$OTHER_ICONPATHS"
1497    # $dnlamVERBOSE "Using OTHER_DESKTOP_PATHS=$OTHER_DESKTOP_PATHS"
1498    # $dnlamVERBOSE "Calling function: createIconMapping"
1499
1500    # $dnlamVERBOSE "Creating $ICONMAPPING" >&2
1501    touch "$ICONMAPPING"
1502    eval createIconMapping $USER_DESKTOP_PATHS $OTHER_DESKTOP_PATHS
1503    # $dnlamVERBOSE "Done createIconMapping."
1504fi
1505
1506# directory for the backgrounds
1507if [ -z "$BACKGROUND_DIRS" ]; then
1508    BACKGROUND_DIRS="${USERFLUXDIR}/backgrounds/:${PREFIX}/share/fluxbox/backgrounds/"
1509fi
1510
1511# find the default terminal
1512if find_it_options $MY_TERM; then
1513    DEFAULT_TERM=$MY_TERM
1514else
1515    [ -n "$MY_TERM" ] && echo "Warning: you chose an invalid term." >&2
1516    #The precise order is up for debate.
1517    for term in Eterm urxvt urxvtc aterm mrxvt rxvt wterm konsole gnome-terminal xterm; do
1518        if find_it_options $term; then
1519            DEFAULT_TERM=$term
1520            break
1521        fi
1522    done
1523fi
1524# a unix system without any terms. that's odd
1525if [ -z "$DEFAULT_TERM" ]; then
1526    cat << EOF >&2
1527
1528Warning: I can't find any terminal-emulators in your PATH.  Please fix
1529your PATH or specify your favourite terminal-emulator with the -t option
1530
1531EOF
1532    DEFAULT_TERM=xterm
1533fi
1534
1535DEFAULT_TERMNAME=`echo $DEFAULT_TERM|awk '{print $1}'`
1536DEFAULT_TERMNAME=`basename $DEFAULT_TERMNAME`
1537
1538
1539# find the default browser
1540if find_it_options $MY_BROWSER; then
1541    DEFAULT_BROWSER=$MY_BROWSER
1542else
1543    [ -n "$MY_BROWSER" ] && echo "Warning: you chose an invalid browser." >&2
1544    #The precise order is up for debate.
1545    for browser in firefox mozilla-firefox chrome chromium google-chrome mozilla-firebird MozillaFirebird linux-opera opera skipstone mozilla seamonkey galeon konqueror dillo netscape w3m amaya links lynx; do
1546        if find_it_options $browser; then
1547            DEFAULT_BROWSER=$browser
1548            break
1549        fi
1550    done
1551fi
1552DEFAULT_BROWSERNAME=`echo $DEFAULT_BROWSER|awk '{print $1}'`
1553if [ "x$DEFAULT_BROWSERNAME" != "x" ]; then
1554	DEFAULT_BROWSERNAME=`basename $DEFAULT_BROWSERNAME`
1555else
1556	DEFAULT_BROWSERNAME="firefox"
1557fi
1558
1559if [ -z "$LAUNCHER" ]; then
1560    LAUNCHER=@pkgprefix@fbrun@pkgsuffix@@EXEEXT@
1561fi
1562if [ -n "$FBRUNOPTIONS" ]; then
1563    # with this, LAUNCHER should be renamed LAUNCHER_NAME, but then there's
1564    # backwards-compatibility...
1565    LAUNCHER_CMD="$LAUNCHER $FBRUNOPTIONS"
1566else
1567    LAUNCHER_CMD=$LAUNCHER
1568fi
1569
1570# if gxmessage exists, use it; else use xmessage
1571if find_it gxmessage; then
1572    XMESSAGE=gxmessage
1573else
1574    XMESSAGE=xmessage
1575fi
1576
1577# Start of menu
1578cat << EOF > ${MENUFILENAME}
1579# Generated by fluxbox-generate_menu
1580#
1581# If you read this it means you want to edit this file manually, so here
1582# are some useful tips:
1583#
1584# - You can add your own menu-entries to ~/.@pkgprefix@fluxbox@pkgsuffix@/usermenu
1585#
1586# - If you miss apps please let me know and I will add them for the next
1587#   release.
1588#
1589# - The -r option prevents removing of empty menu entries and lines which
1590#   makes things much more readable.
1591#
1592# - To prevent any other app from overwriting your menu
1593#   you can change the menu name in ~/.@pkgprefix@fluxbox@pkgsuffix@/init to:
1594#     session.menuFile: ~/.@pkgprefix@fluxbox@pkgsuffix@/my-menu
1595
1596EOF
1597
1598echo "[begin] (${MENUTITLE})" >> ${MENUFILENAME}
1599
1600if [ -n "$MENU_ENCODING" ]; then
1601    append_menu "[encoding] {$MENU_ENCODING}"
1602fi
1603
1604append "[exec] (${DEFAULT_TERMNAME}) {${DEFAULT_TERM}}"
1605
1606case "$DEFAULT_BROWSERNAME" in
1607    links|w3m|lynx)  append "[exec] (${DEFAULT_BROWSERNAME}) {${DEFAULT_TERM} -e ${DEFAULT_BROWSER} ${HOMEPAGE}}" ;;
1608    firefox|firebird|mozilla|seamonkey|phoenix|galeon|dillo|netscape|amaya) append "[exec] (${DEFAULT_BROWSERNAME}) {${DEFAULT_BROWSER}}" ;;
1609    chrome|chromium) append "[exec] (${DEFAULT_BROWSERNAME}) {${DEFAULT_BROWSER}}" ;;
1610    google-chrome) append "[exec] (${DEFAULT_BROWSERNAME}) {${DEFAULT_BROWSER}}" ;;
1611    konqueror) append "[exec] (konqueror) {kfmclient openProfile webbrowsing}" ;;
1612    linux-opera) append "[exec] (linux-opera) {env QT_XFT=true linux-opera}" ;;
1613    opera) append "[exec] (opera) {env QT_XFT=true opera}" ;;
1614    MozillaFirebird) append "[exec] (firebird) {MozillaFirebird}" ;;
1615    MozillaFirefox) append "[exec] (firefox) {MozillaFirefox}" ;;
1616    *) append "[exec] ($DEFAULT_BROWSERNAME) {$DEFAULT_BROWSER}" ;;
1617esac
1618
1619find_it "${LAUNCHER}" append "[exec]   (${RUNCOMMAND}) {$LAUNCHER_CMD}"
1620
1621
1622append_submenu "${TERMINALMENU}"
1623    normal_find xterm urxvt urxvtc gnome-terminal multi-gnome-terminal Eterm \
1624        konsole aterm mlterm multi-aterm rxvt mrxvt lxterminal
1625append_menu_end
1626
1627
1628append_submenu "${NETMENU}"
1629    append_submenu "${BROWSERMENU}"
1630        normal_find chrome chromium firefox google-chrome mozilla-firefox MozillaFirefox galeon mozilla seamonkey dillo netscape vncviewer
1631        find_it links       append "[exec]   (links-graphic) {links -driver x ${HOMEPAGE}}"
1632        find_it linux-opera append "[exec]   (linux-opera) {env QT_XFT=true linux-opera}"
1633        find_it opera       append "[exec]   (opera) {env QT_XFT=true opera}"
1634        find_it konqueror   append "[exec]   (konqueror) {kfmclient openProfile webbrowsing}"
1635        find_it links       append "[exec]   (links) {${DEFAULT_TERM} -e links ${HOMEPAGE}}"
1636        find_it w3m         append "[exec]   (w3m) {${DEFAULT_TERM} -e w3m ${HOMEPAGE}}"
1637        find_it lynx        append "[exec]   (lynx) {${DEFAULT_TERM} -e lynx ${HOMEPAGE}}"
1638    append_menu_end
1639
1640    append_submenu IM
1641        normal_find pidgin gaim kopete gnomemeeting sim kadu psi amsn aim ayttm everybuddy gabber ymessenger
1642        find_it licq        append "[exec]   (licq) {env QT_XFT=true licq}"
1643        cli_find centericq micq
1644    append_menu_end
1645
1646    append_submenu Mail
1647        normal_find sylpheed kmail evolution thunderbird mozilla-thunderbird \
1648            sylpheed-claws claws-mail
1649        cli_find mutt pine
1650    append_menu_end
1651
1652    append_submenu News
1653        normal_find liferea pears pan
1654        cli_find slrn tin
1655    append_menu_end
1656
1657    append_submenu IRC
1658        normal_find xchat xchat-2 ksirc vyqchat lostirc logui konversation kvirc skype
1659        cli_find irssi epic4 weechat ninja
1660        find_it BitchX        append "[exec]   (BitchX) {${DEFAULT_TERM} -e BitchX -N}" || \
1661        find_it bitchx        append "[exec]   (BitchX) {${DEFAULT_TERM} -e bitchx -N}"
1662        find_it ircii         append "[exec]   (ircii) {${DEFAULT_TERM} -e ircii -s}"
1663    append_menu_end
1664
1665    append_submenu P2P
1666        normal_find gtk-gnutella lopster nicotine pyslsk xmule amule \
1667            valknut dcgui-qt dc_qt quickdc asami azureus
1668        cli_find TekNap giFTcurs
1669    append_menu_end
1670
1671    append_submenu FTP
1672        normal_find gftp IglooFTP-PRO kbear
1673        cli_find ncftp pftp ftp lftp yafc
1674    append_menu_end
1675
1676    append_submenu SMB
1677      normal_find LinNeighborhood jags SambaSentinel
1678    append_menu_end
1679
1680    append_submenu "${ANALYZERMENU}"
1681	  normal_find xnmap nmapfe wireshark ettercap
1682	  sudo_find xnmap nmapfe wireshark ettercap
1683    append_menu_end
1684
1685    normal_find x3270 wpa_gui
1686
1687append_menu_end
1688
1689append_submenu "${EDITORMENU}"
1690    normal_find gvim bluefish nedit gedit geany xedit kword kwrite kate anjuta \
1691        wings xemacs emacs kvim cream evim scite Ted
1692    cli_find nano vim vi zile jed joe
1693    find_it     emacs  append "[exec]   (emacs-nw) {${DEFAULT_TERM} -e emacs -nw}"
1694    find_it     xemacs append "[exec]   (xemacs-nw) {${DEFAULT_TERM} -e xemacs -nw}"
1695append_menu_end
1696
1697append_submenu "${EDUCATIONMENU}"
1698    normal_find celestia scilab geomview scigraphica oregano xcircuit electric \
1699        pymol elem chemtool xdrawchem gperiodic stellarium
1700    find_it drgeo          append "[exec] (Dr. Geo) {drgeo}"
1701    find_it     R          append "[exec] (R) {${DEFAULT_TERM} -e R --gui=gnome}"
1702    cli_find maxima grace yacas octave gnuplot grass coq acl
1703append_menu_end
1704
1705append_submenu "${FILEUTILSMENU}"
1706    find_it     konqueror append "[exec] (konqueror) {kfmclient openProfile filemanagement}"
1707    normal_find gentoo krusader kcommander linuxcmd rox tuxcmd krename xfe xplore worker endeavour2 evidence
1708    find_it     nautilus append "[exec] (nautilus) {nautilus --no-desktop --browser}"
1709    cli_find mc
1710append_menu_end
1711
1712append_submenu "${MULTIMEDIAMENU}"
1713       append_submenu "${GRAPHICMENU}"
1714               normal_find gimp gimp2 gimp-2.2 inkscape sodipodi xv gqview showimg xpaint kpaint kiconedit \
1715                   ee xzgv xscreensaver-demo xlock gphoto tuxpaint krita skencil
1716               find_it xnview           append "[exec] (xnview browser) {xnview -browser}"
1717               find_it blender          append "[exec] (blender) {blender -w}"
1718               find_it gears            append "[exec] (Mesa gears) {gears}"
1719               find_it morph3d          append "[exec] (Mesa morph) {morph3d}"
1720               find_it reflect          append "[exec] (Mesa reflect) {reflect}"
1721       append_menu_end
1722
1723       append_submenu "${MUSICMENU}"
1724               normal_find xmms noatun alsaplayer gqmpeg aumix xmixer gnome-alsamixer gmix kmix kscd \
1725                   grecord kmidi xplaycd soundtracker grip easytag audacity \
1726                   zinf rhythmbox kaboodle beep-media-player amarok tagtool \
1727                   audacious bmpx
1728               cli_find cdcd cplay alsamixer orpheus mp3blaster
1729       append_menu_end
1730
1731
1732       append_submenu "${VIDEOMENU}"
1733           normal_find xine gxine aviplay gtv gmplayer xmovie xcdroast xgdb \
1734               realplay xawtv fxtv ogle goggles vlc
1735           find_it dvdrip append "[exec] (dvdrip) {nohup dvdrip}"
1736       append_menu_end
1737
1738       append_submenu "${XUTILSMENU}"
1739           normal_find xfontsel xman xload xbiff editres viewres xclock \
1740               xmag wmagnify gkrellm gkrellm2 vmware portagemaster agave
1741           find_it xrdb append "[exec] (Reload .Xdefaults) {xrdb -load \$HOME/.Xdefaults}"
1742       append_menu_end
1743append_menu_end
1744
1745
1746append_submenu "${OFFICEMENU}"
1747    normal_find xclock xcalc kcalc grisbi qbankmanager evolution
1748    find_it gcalc           append "[exec] (gcalc) {gcalc}" || \
1749        find_it gnome-calculator append "[exec] (gcalc) {gnome-calculator}"
1750    find_it ical            append "[exec] (Calendar)   {ical}"
1751
1752    # older <=1.1.3 apparently have stuff like swriter, not sowriter
1753    for ext in s so oo xoo; do
1754        find_it ${ext}ffice2 && (
1755            find_it ${ext}ffice2        append "[exec] (Open Office 2)  {${ext}ffice2}"
1756            find_it ${ext}base2         append "[exec] (OO Base 2)      {${ext}base2}"
1757            find_it ${ext}calc2         append "[exec] (OO Calc 2)      {${ext}calc2}"
1758            find_it ${ext}writer2       append "[exec] (OO Writer 2)    {${ext}writer2}"
1759            find_it ${ext}web2          append "[exec] (OO Web 2)       {${ext}web2}"
1760            find_it ${ext}html2         append "[exec] (OO HTML 2)      {${ext}html2}"
1761            find_it ${ext}impress2      append "[exec] (OO Impress 2)   {${ext}impress2}"
1762            find_it ${ext}draw2         append "[exec] (OO Draw 2)      {${ext}draw2}"
1763            find_it ${ext}math2         append "[exec] (OO Math 2)      {${ext}math2}"
1764            find_it ${ext}fromtemplate2 append "[exec] (OO Templates 2) {${ext}fromtemplate2}"
1765        )
1766        find_it ${ext}ffice && (
1767            find_it ${ext}ffice        append "[exec] (Open Office)      {${ext}ffice}"
1768            find_it ${ext}base         append "[exec] (OO Base)          {${ext}base}"
1769            find_it ${ext}calc         append "[exec] (OO Calc)          {${ext}calc}"
1770            find_it ${ext}writer       append "[exec] (OO Writer)        {${ext}writer}"
1771            find_it ${ext}web          append "[exec] (OO Web)           {${ext}web}"
1772            find_it ${ext}impress      append "[exec] (OO Impress)       {${ext}impress}"
1773            find_it ${ext}draw         append "[exec] (OO Draw)          {${ext}draw}"
1774            find_it ${ext}math         append "[exec] (OO Math)          {${ext}math}"
1775            find_it ${ext}fromtemplate append "[exec] (OO Templates)     {${ext}fromtemplate}"
1776            find_it ${ext}padmin       append "[exec] (OO Printer Admin) {${ext}padmin}"
1777            find_it mrproject          append "[exec] (Mr.Project)       {mrproject}"
1778        )
1779    done
1780
1781    normal_find abiword kword wordperfect katoob lyx acroread xpdf gv ghostview
1782    normal_find dia xfig
1783    normal_find gnumeric
1784append_menu_end
1785
1786append_submenu "${GAMESMENU}"
1787    normal_find bzflag gnibbles gnobots2 tuxpuck gataxx glines \
1788        gnect mahjongg gnomine gnome-stones gnometris gnotravex \
1789        gnotski iagno knights eboard xboard scid freecell pysol \
1790        gtali tuxracer xpenguins xsnow xeyes smclone \
1791        openmortal quake2 quake3 skoosh same-gnome enigma xbill \
1792        icebreaker scorched3d sol dosbox black-box freeciv \
1793        freeciv-server frozen-bubble liquidwar qt-nethack \
1794        nethack-gnome pathological scummvm xqf \
1795        wesnoth canfeild ace_canfeild golf merlin chickens \
1796        supertux tuxdash  neverball cube_client blackjack \
1797        doom doom3 quake4 blackshades gltron kpoker concentration \
1798        torrent scramble kiki xmoto warsow wormux zsnes
1799    cli_find gnugo xgame
1800
1801    find_it et append "[exec] (Enemy Territory) {et}"
1802    find_it ut append "[exec] (Unreal Tournament) {ut}"
1803    find_it ut2003 append "[exec] (Unreal Tournament 2003) {ut2003}"
1804    find_it ut2004 append "[exec] (Unreal Tournament 2004) {ut2004}"
1805append_menu_end
1806
1807append_submenu "${SYSTEMTOOLSMENU}"
1808  append_submenu "${BURNINGMENU}"
1809    normal_find k3b cdbakeoven graveman xcdroast arson eroaster gcombust \
1810                gtoaster kiso kover gtkcdlabel kcdlabel cdw cdlabelgen
1811    cli_find     mp3burn cdrx burncenter
1812  append_menu_end
1813
1814  normal_find firestarter gtk-lshw gproftd gpureftpd guitoo porthole gtk-iptables \
1815              gtk-cpuspeedy
1816  find_it    fireglcontrol   append "[exec] (ATI Config) {fireglcontrol}"
1817  cli_find    top htop iotop ntop powertop
1818append_menu_end
1819
1820
1821
1822
1823# We'll only use this once
1824ETCAPPLNK=/etc/X11/applnk
1825PARSING_DESKTOP="true"
1826# gnome menu
1827if [ "${GNOMEMENU}" ]; then
1828    append_submenu "${GNOMEMENUTEXT}"
1829    recurse_dir_menu "${GNOME_PREFIX}/share/gnome/apps" "$HOME/.gnome/apps" ${ETCAPPLNK}
1830    append_menu_end
1831    unset ETCAPPLNK
1832fi
1833
1834# kde submenu
1835if [ -d "${KDE_PREFIX}/share/applnk/" -a "${KDEMENU}" ]; then
1836    append_submenu "${KDEMENUTEXT}"
1837    recurse_dir_menu "${KDE_PREFIX}/share/applnk" "$HOME/.kde/share/applnk" ${ETCAPPLNK}
1838    append_menu_end
1839    unset ETCAPPLNK
1840fi
1841unset PARSING_DESKTOP
1842
1843#User menu
1844if [ -r "${USERMENU}" ]; then
1845    cat ${USERMENU} >> ${MENUFILENAME}
1846fi
1847
1848append_submenu "${FBSETTINGSMENU}"
1849    append "[config] (${CONFIGUREMENU})"
1850
1851    append_menu "[submenu] (${SYSTEMSTYLES}) {${STYLEMENUTITLE}}"
1852        append "[stylesdir] (${PREFIX}/share/fluxbox/styles)"
1853    append_menu_end
1854
1855    append_menu "[submenu] (${USERSTYLES}) {${STYLEMENUTITLE}}"
1856        append "[stylesdir] (~/.@pkgprefix@fluxbox@pkgsuffix@/styles)"
1857    append_menu_end
1858
1859    # Backgroundmenu
1860    addbackground() {
1861                picturename=`basename "$1"`
1862                append "[exec] (${picturename%.???}) {@pkgprefix@fbsetbg@pkgsuffix@ -a \"$1\" }"
1863    }
1864
1865    if [ "$BACKGROUNDMENUITEM" = yes ]; then
1866        IFS=: # set delimetor for find
1867        NUMBER_OF_BACKGROUNDS=`find $BACKGROUND_DIRS -follow -type f 2> /dev/null|wc -l`
1868        if [ "$NUMBER_OF_BACKGROUNDS" -gt 0 ]; then
1869            append_menu "[submenu] (${BACKGROUNDMENU}) {${BACKGROUNDMENUTITLE}}"
1870            append "[exec] (${RANDOMBACKGROUND}) {@pkgprefix@fbsetbg@pkgsuffix@ -r ${USERFLUXDIR}/backgrounds}"
1871            if [ "$NUMBER_OF_BACKGROUNDS" -gt 30 ]; then
1872                menucounter=1 ; counter=1
1873                append_menu "[submenu] (${BACKGROUNDMENU} $menucounter) {${BACKGROUNDMENUTITLE}}"
1874                find $BACKGROUND_DIRS -follow -type f|sort|while read i; do
1875                    counter=`expr $counter + 1`
1876                    if [ $counter -eq 30 ]; then
1877                        counter=1
1878                        menucounter=`expr $menucounter + 1`
1879                        append_menu_end
1880                        append_menu "[submenu] (${BACKGROUNDMENU} $menucounter) {${BACKGROUNDMENUTITLE}}"
1881                    fi
1882                    addbackground "$i"
1883                done
1884                append_menu_end
1885            else
1886                find $BACKGROUND_DIRS -follow -type f|sort|while read i; do
1887                addbackground "$i"
1888                done
1889            fi
1890            append_menu_end
1891        else
1892            echo "Warning: You wanted a background-menu but I couldn't find any backgrounds in:
1893    $BACKGROUND_DIRS" >&2
1894        fi
1895    fi
1896
1897    append "[workspaces] (${WORKSPACEMENU})"
1898
1899    append_submenu "${TOOLS}"
1900        normal_find fluxconf fluxkeys fluxmenu
1901        find_it fbpanel append "[exec] (Fluxbox panel) {fbpanel}"
1902        find_it $XMESSAGE append \
1903            "[exec] (${WINDOWNAME}) {xprop WM_CLASS|cut -d \\\" -f 2|$XMESSAGE -file - -center}"
1904        find_it import append "[exec] (${SCREENSHOT} - JPG) {import screenshot.jpg && display -resize 50% screenshot.jpg}"
1905        find_it import append "[exec] (${SCREENSHOT} - PNG) {import screenshot.png && display -resize 50% screenshot.png}"
1906        find_it ${LAUNCHER} append "[exec] (${RUNCOMMAND}) {$LAUNCHER_CMD}"
1907        find_it switch append "[exec] (gtk-theme-switch) {switch}"
1908        find_it switch2 append "[exec] (gtk2-theme-switch) {switch2}"
1909        find_it @pkgprefix@fluxbox-generate_menu@pkgsuffix@ append "[exec] (${REGENERATEMENU}) {$FBGM_CMD}"
1910    append_menu_end
1911
1912    append_submenu "${WINDOWMANAGERS}"
1913    #hard to properly maintain since there are so many exceptions to the rule.
1914    for wm in mwm twm wmii beryl compiz metacity icewm ion kde sawfish enlightenment fvwm openbox evilwm waimea xfce pekwm xfce4 fvwm2 blackbox ; do
1915        find_it start${wm} append "[restart] (${wm}) {start${wm}}" ||\
1916            find_it ${wm} append "[restart] (${wm}) {${wm}}"
1917    done
1918        find_it startgnome append "[restart] (gnome) {startgnome}" ||\
1919            find_it gnome-session append "[restart] (gnome) {gnome-session}"
1920
1921        find_it startwindowmaker append "[restart] (windowmaker) {startwindowmaker}" ||\
1922            find_it wmaker append "[restart] (windowmaker) {wmaker}"
1923    append_menu_end
1924    find_it xlock append "[exec] (${LOCKSCREEN}) {xlock}" ||\
1925        find_it xscreensaver-command append "[exec] (${LOCKSCREEN}) {xscreensaver-command -lock}"
1926    append "[commanddialog] (${FLUXBOXCOMMAND})"
1927    append "[reconfig] (${RELOADITEM})"
1928    append "[restart] (${RESTARTITEM})"
1929    append "[exec] (${ABOUTITEM}) {(@pkgprefix@fluxbox@pkgsuffix@@EXEEXT@ -v; @pkgprefix@fluxbox@pkgsuffix@@EXEEXT@ -info | sed 1d) | $XMESSAGE -file - -center}"
1930    append "[separator]"
1931    append "[exit] (${EXITITEM})"
1932
1933    append_menu_end
1934
1935if [ -n "$MENU_ENCODING" ]; then
1936    append_menu "[endencoding]"
1937fi
1938
1939append_menu_end
1940
1941# this function removes empty menu items. It can not yet  remove  nested
1942# empty submenus :\
1943
1944if [ ! "${REMOVE}" ]; then
1945    clean_up
1946fi
1947
1948# escapes any parentheses in menu label
1949# e.g.,  "[exec] (konqueror (web))" becomes  "[exec] (konqueror (web\))"
1950sed 's/(\(.*\)(\(.*\)))/(\1 (\2\\))/' $MENUFILENAME > $MENUFILENAME.tmp
1951mv -f $MENUFILENAME.tmp $MENUFILENAME
1952
1953if [ -z "$INSTALL" ]; then
1954    if [ -z "$CHECKINIT" ]; then
1955        INITMENUFILENAME=`awk '/menuFile/ {print $2}' $USERFLUXDIR/init`
1956        INITMENUFILENAME=`replaceWithinString "$INITMENUFILENAME" "~" "$HOME"`
1957        if [ ! "$INITMENUFILENAME" = "$MENUFILENAME" ]; then
1958            echo "Note: In $USERFLUXDIR/init, your \"session.menuFile\" does not point to $MENUFILENAME but to $INITMENUFILENAME" >&2
1959        fi
1960    fi
1961    echo "Menu successfully generated: $MENUFILENAME"
1962    #echo "  Make sure \"session.menuFile: $MENUFILENAME\" is in $HOME/.@pkgprefix@fluxbox@pkgsuffix@/init."
1963    echo 'Use @pkgprefix@fluxbox-generate_menu@pkgsuffix@ -h to read about all the latest features.'
1964fi
1965