From 475e2c09feabf8c41e67529642e2f746b1e8efa0 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Sat, 19 Oct 2002 14:34:08 +0000 Subject: applied patch from Han --- util/fluxbox-generate_menu | 369 ++++++++++++++++++++++++--------------------- 1 file changed, 196 insertions(+), 173 deletions(-) diff --git a/util/fluxbox-generate_menu b/util/fluxbox-generate_menu index 4c99292..1c6a3de 100755 --- a/util/fluxbox-generate_menu +++ b/util/fluxbox-generate_menu @@ -14,96 +14,106 @@ # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. +PATH=/bin:/usr/bin/:/usr/local/bin:/usr/X11R6/bin + + # Functions +display_usage() { + cat < /dev/null 2> /dev/null && shift && $* +display_authors() { + cat < /dev/null 2> /dev/null && shift && $* } append() { - echo " $*" >> ${FILENAME} + echo " $*" >> ${FILENAME} } append_menu() { - echo "$*" >> ${FILENAME} + echo "$*" >> ${FILENAME} } append_submenu() { - echo >> ${FILENAME} - append_menu "[submenu] ($1)" + echo >> ${FILENAME} + append_menu "[submenu] ($1)" } append_menu_end() { - append_menu "[end]" - echo >> ${FILENAME} + append_menu "[end]" + echo >> ${FILENAME} } menu_entry() { - append "[exec] ("`grep -v GenericName $* | grep Name= | cut -d = -f 2`") \ + append "[exec] ("`grep -v GenericName $* | grep Name= | cut -d = -f 2`") \ {"`grep -v TryExec $* | grep Exec= | cut -d = -f 2`"}" } menu_entry_dircheck() { - if [ -d "$*" ]; then - menu_entry_dir "$*" - fi + if [ -d "$*" ]; then + menu_entry_dir "$*" + fi } menu_entry_dir() { - for b in `ls "$*"/*.desktop 2>/dev/null `; do - menu_entry "${b}" - done + for b in `ls "$*"/*.desktop 2>/dev/null `; do + menu_entry "${b}" + done } # 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} ;; @@ -118,43 +128,59 @@ done # menufile name and make a backup if [ -z ${FILENAME} ]; then - FILENAME=${HOME}/.fluxbox/menu + FILENAME=${HOME}/.fluxbox/menu fi -if [ ! -z ${FILENAME} ]; then - if [ -w ${FILENAME} ]; then - cp -f ${FILENAME} ${FILENAME}.bak - fi +if [ ! -z ${FILENAME} ]; then + if [ -w ${FILENAME} ]; then + cp -f ${FILENAME} ${FILENAME}.bak + fi fi #packagedatadir if [ -z "${PKGDATADIR}" ]; then - PKGDATADIR=/usr/share + PKGDATADIR=/usr/share fi # menutitle if [ -z "${MENUTITLE}" ]; then - MENUTITLE="Fluxbox" + MENUTITLE="Fluxbox" fi -if find_it xterm; then - DEFAULT_TERM=xterm +# 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 - for term in konsole gnome-terminal Eterm wterm aterm rxvt; do - find_term $term - if [ -nz $DEFAULT_TERM ]; then - break - fi - done + DEFAULT_TERM=$MY_TERM fi + + +# a unix system without any terms. that's odd +if [ -z "$DEFAULT_TERM" ];then + cat < ${FILENAME} -append "[exec] (${DEFAULT_TERM}) {${DEFAULT_TERM}}" -find_it nedit append "[exec] (nedit) {nedit}" +append "[exec] (${DEFAULT_TERM}) {${DEFAULT_TERM}}" +find_it nedit append "[exec] (nedit) {nedit}" append_submenu ${BROWSERMENU} find_it netscape append "[exec] (netscape) {netscape}" - find_it opera append "[exec] (opera) {env QT_XFT=true opera}" - find_it galeon append "[exec] (galeon) {galeon}" - find_it mozilla append "[exec] (mozilla) {mozilla}" + find_it opera append "[exec] (opera) {env QT_XFT=true opera}" + find_it galeon append "[exec] (galeon) {galeon}" + find_it mozilla append "[exec] (mozilla) {mozilla}" find_it konqueror append "[exec] (konqueror) {konqueror}" - find_it links append "[exec] (links) {${DEFAULT_TERM} -title links -e links fluxbox.sf.net}" - find_it w3m append "[exec] (w3m) {${DEFAULT_TERM} -title w3m -e w3m}" - find_it lynx append "[exec] (lynx) {${DEFAULT_TERM} -title lynx -e lynx}" - find_it dillo append "[exec] (dillo) {dillo}" + find_it links append "[exec] (links) {${DEFAULT_TERM} -title links -e links fluxbox.sf.net}" + find_it w3m append "[exec] (w3m) {${DEFAULT_TERM} -title w3m -e w3m}" + find_it lynx append "[exec] (lynx) {${DEFAULT_TERM} -title lynx -e lynx}" + find_it dillo append "[exec] (dillo) {dillo}" append_menu_end append_submenu ${EDITORMENU} - find_it nedit append "[exec] (nedit) {nedit}" - find_it vim append "[exec] (vim) {vim -g}" - find_it xemacs append "[exec] (xemacs) {xemacs}" - find_it emacs append "[exec] (emacs) {emacs}" - find_it gedit append "[exec] (gedit) {gedit}" - find_it xedit append "[exec] (xedit) {xedit}" - find_it kword append "[exec] (kword) {kword}" - find_it kwrite append "[exec] (kwrite) {kwrite}" - find_it kate append "[exec] (kate) {kate}" + find_it nedit append "[exec] (nedit) {nedit}" + find_it vim append "[exec] (vim) {vim -g}" + find_it xemacs append "[exec] (xemacs) {xemacs}" + find_it emacs append "[exec] (emacs) {emacs}" + find_it gedit append "[exec] (gedit) {gedit}" + find_it xedit append "[exec] (xedit) {xedit}" + find_it kword append "[exec] (kword) {kword}" + find_it kwrite append "[exec] (kwrite) {kwrite}" + find_it kate append "[exec] (kate) {kate}" append_menu_end append_submenu ${NETMENU} find_it realplay append "[exec] (realplayer) {realplay}" - find_it licq append "[exec] (licq) {env QT_XFT=true licq}" - find_it gaim append "[exec] (gaim) {gaim}" + find_it licq append "[exec] (licq) {env QT_XFT=true licq}" + find_it gaim append "[exec] (gaim) {gaim}" find_it sylpheed append "[exec] (sylpheed) {sylpheed}" - find_it kmail append "[exec] (kmail) {kmail}" - find_it gnomemeeting append "[exec] (gnomemeeting) {gnomemeeting}" + find_it kmail append "[exec] (kmail) {kmail}" + find_it gnomemeeting append "[exec] (gnomemeeting) {gnomemeeting}" find_it evolution append "[exec] (evolution) {evolution}" - find_it mutt append "[exec] (mutt) {${DEFAULT_TERM} -title mutt -e mutt}" - - find_it gftp append "[exec] (gftp) {gftp}" - find_it pan append "[exec] (pan) {pan}" - find_it xchat append "[exec] (xchat) {xchat}" - find_it irssi append "[exec] (irssi) {${DEFAULT_TERM} -title irssi -e irssi}" - find_it BitchX append "[exec] (BitchX) {${DEFAULT_TERM} -title BitchX -e BitchX -N}" - find_it bitchx append "[exec] (BitchX) {${DEFAULT_TERM} -title BitchX -e bitchx -N}" - find_it ircii append "[exec] (ircii) {${DEFAULT_TERM} -title ircii -e ircii -s}" + find_it mutt append "[exec] (mutt) {${DEFAULT_TERM} -title mutt -e mutt}" + + find_it gftp append "[exec] (gftp) {gftp}" + find_it pan append "[exec] (pan) {pan}" + find_it xchat append "[exec] (xchat) {xchat}" + find_it irssi append "[exec] (irssi) {${DEFAULT_TERM} -title irssi -e irssi}" + find_it BitchX append "[exec] (BitchX) {${DEFAULT_TERM} -title BitchX -e BitchX -N}" + find_it bitchx append "[exec] (BitchX) {${DEFAULT_TERM} -title BitchX -e bitchx -N}" + find_it ircii append "[exec] (ircii) {${DEFAULT_TERM} -title ircii -e ircii -s}" append_menu_end append_submenu ${GRAPHICMENU} - find_it gimp append "[exec] (gimp) {gimp}" + find_it gimp append "[exec] (gimp) {gimp}" find_it gimp-1.3 append "[exec] (gimp 1.3) {gimp-1.3}" - find_it xv append "[exec] (xv) {xv}" - find_it gqview append "[exec] (gqview) {gqview}" - find_it xpaint append "[exec] (xpaint) {xpaint}" - find_it kpaint append "[exec] (kpaint) {kpaint}" + find_it xv append "[exec] (xv) {xv}" + find_it gqview append "[exec] (gqview) {gqview}" + find_it xpaint append "[exec] (xpaint) {xpaint}" + find_it kpaint append "[exec] (kpaint) {kpaint}" find_it kiconedit append "[exec] (kiconedit) {kiconedit}" find_it xscreensaver-demo append "[exec] (xscreensaver-demo) {xscreensaver-demo}" append_menu_end append_submenu ${MUSICMENU} - find_it xmms append "[exec] (xmms) {xmms}" - find_it gqmpeg append "[exec] (gqmpeg) {gqmpeg}" - find_it xmixer append "[exec] (xmixer) {xmixer}" - find_it gmix append "[exec] (gmix) {gmix}" - find_it kmix append "[exec] (kmix) {kmix}" - find_it grecord append "[exec] (grecord) {grecord}" - find_it kmidi append "[exec] (kmidi) {kmidi}" - find_it xplaycd append "[exec] (xplaycd) {xplaycd}" + find_it xmms append "[exec] (xmms) {xmms}" + find_it gqmpeg append "[exec] (gqmpeg) {gqmpeg}" + find_it xmixer append "[exec] (xmixer) {xmixer}" + find_it gmix append "[exec] (gmix) {gmix}" + find_it kmix append "[exec] (kmix) {kmix}" + find_it grecord append "[exec] (grecord) {grecord}" + find_it kmidi append "[exec] (kmidi) {kmidi}" + find_it xplaycd append "[exec] (xplaycd) {xplaycd}" find_it soundtracker append "[exec] (soundtracker) {soundtracker}" - find_it cplay append "[exec] (cplay) {${DEFAULT_TERM} -title cplay -e /usr/local/bin/cplay}" - find_it grip append "[exec] (grip) {grip}" + find_it cplay append "[exec] (cplay) {${DEFAULT_TERM} -title cplay -e /usr/local/bin/cplay}" + find_it grip append "[exec] (grip) {grip}" append_menu_end -append_submenu ${TERMINALMENU} - find_it xterm append "[exec] (xterm) {xterm}" +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}" - find_it konsole append "[exec] (konsole) {konsole}" - find_it aterm append "[exec] (aterm) {aterm}" - find_it rxvt append "[exec] (rxvt) {rxvt}" + find_it Eterm append "[exec] (Eterm) {Eterm}" + find_it konsole append "[exec] (konsole) {konsole}" + find_it aterm append "[exec] (aterm) {aterm}" + find_it rxvt append "[exec] (rxvt) {rxvt}" append_menu_end append_submenu ${MISCMENU} find_it acroread append "[exec] (acroread) {acroread}" - find_it xpdf append "[exec] (xpdf) {xpdf}" - find_it xine append "[exec] (xine) {xine}" - find_it aviplay append "[exec] (aviplay) {aviplay}" - find_it gtv append "[exec] (gtv) {gtv}" - find_it xmovie append "[exec] (xmovie) {xmovie}" + find_it xpdf append "[exec] (xpdf) {xpdf}" + find_it xine append "[exec] (xine) {xine}" + find_it aviplay append "[exec] (aviplay) {aviplay}" + find_it gtv append "[exec] (gtv) {gtv}" + find_it xmovie append "[exec] (xmovie) {xmovie}" find_it xcdroast append "[exec] (xcdroast) {xcdroast}" - find_it gcalc append "[exec] (gcalc) {gcalc}" - find_it kcalc append "[exec] (kcalc) {kcalc}" + find_it gcalc append "[exec] (gcalc) {gcalc}" + find_it kcalc append "[exec] (kcalc) {kcalc}" find_it kpackage append "[exec] (kpackage) {kpackage}" - find_it xgdb append "[exec] (xgdb) {xgdb}" - find_it ddd append "[exec] (ddd) {ddd}" - find_it ${DEFAULT_TERM} append "[exec] (tail access_log) {${DEFAULT_TERM} -title access_log -e tail -f /var/log/access_log}" + find_it xgdb append "[exec] (xgdb) {xgdb}" + find_it ddd append "[exec] (ddd) {ddd}" + find_it ${DEFAULT_TERM} append "[exec] (tail access_log) {${DEFAULT_TERM} -title access_log -e tail -f /var/log/access_log}" append_menu_end append_submenu ${XUTILSMENU} find_it xpenguins append "[exec] (xpenguins) {xpenguins}" - find_it xcalc append "[exec] (xcalc) {xcalc}" + find_it xcalc append "[exec] (xcalc) {xcalc}" find_it xfontsel append "[exec] (xfontsel) {xfontsel}" - find_it xman append "[exec] (xman) {xman}" - find_it xload append "[exec] (xload) {xload}" - find_it xfig append "[exec] (xfig) {xfig}" - find_it xbiff append "[exec] (xbiff) {xbiff}" - find_it editres append "[exec] (editres) {editres}" - find_it viewres append "[exec] (viewres) {viewres}" - find_it xsnow append "[exec] (xsnow) {xsnow}" - find_it xclock append "[exec] (xclock) {xclock}" + find_it xman append "[exec] (xman) {xman}" + find_it xload append "[exec] (xload) {xload}" + find_it xfig append "[exec] (xfig) {xfig}" + find_it xbiff append "[exec] (xbiff) {xbiff}" + find_it editres append "[exec] (editres) {editres}" + find_it viewres append "[exec] (viewres) {viewres}" + find_it xsnow append "[exec] (xsnow) {xsnow}" + find_it xclock append "[exec] (xclock) {xclock}" append_menu_end # gnome menu if [ -d ${PKGDATADIR}/gnome/apps -a "${GNOMEMENU}" ]; then - append_submenu ${GNOMEMENUTEXT} - for a in `ls ${PKGDATADIR}/gnome/apps`; do - if [ -d ${PKGDATADIR}/gnome/apps/"${a}" ] ; then - append_submenu "${a}" - menu_entry_dir "${PKGDATADIR}/gnome/apps/"${a}"" - menu_entry_dircheck "/etc/X11/applnk/"${a}"" - append_menu_end - fi - done - append_menu_end + append_submenu ${GNOMEMENUTEXT} + for a in `ls ${PKGDATADIR}/gnome/apps`; do + if [ -d ${PKGDATADIR}/gnome/apps/"${a}" ] ; then + append_submenu "${a}" + menu_entry_dir "${PKGDATADIR}/gnome/apps/"${a}"" + menu_entry_dircheck "/etc/X11/applnk/"${a}"" + append_menu_end + fi + done + append_menu_end fi # kde submenu if [ -d ${PKGDATADIR}/applnk/ -a "${KDEMENU}" ]; then - append_submenu ${KDEMENUTEXT} - for a in `ls ${PKGDATADIR}/applnk/`; do - if [ -d ${PKGDATADIR}/applnk/"${a}" ]; then - append_submenu "${a}" - for x in `ls ${PKGDATADIR}/applnk/"${a}"`; do - if [ -d ${PKGDATADIR}/applnk/"${a}"/"${x}" ]; then - append_submenu "${x}" - menu_entry_dir ${PKGDATADIR}/applnk/"${a}"/"${x}" - append_menu_end - fi - done - menu_entry_dir ${PKGDATADIR}/applnk/"${a}" - append_menu_end + append_submenu ${KDEMENUTEXT} + for a in `ls ${PKGDATADIR}/applnk/`; do + if [ -d ${PKGDATADIR}/applnk/"${a}" ]; then + append_submenu "${a}" + for x in `ls ${PKGDATADIR}/applnk/"${a}"`; do + if [ -d ${PKGDATADIR}/applnk/"${a}"/"${x}" ]; then + append_submenu "${x}" + menu_entry_dir ${PKGDATADIR}/applnk/"${a}"/"${x}" + append_menu_end fi - done - menu_entry_dir ${PKGDATADIR}/applnk/ - append_menu_end + done + menu_entry_dir ${PKGDATADIR}/applnk/"${a}" + append_menu_end + fi + done + menu_entry_dir ${PKGDATADIR}/applnk/ + append_menu_end fi @@ -476,7 +502,7 @@ append_submenu ${FBSETTINGSMENU} append "[config] (${CONFIGUREMENU})" append "[reconfig] (${RELOADITEM})" - + find_it fluxconf append "[exec] (Fluxconf) {fluxconf}" # if gxmessage exitst use it; else use xmessage @@ -490,6 +516,3 @@ append_menu_end append "[exit] (${EXITITEM})" append_menu_end - - - -- cgit v0.11.2