diff options
author | fluxgen <fluxgen> | 2002-11-12 19:19:14 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2002-11-12 19:19:14 (GMT) |
commit | d1292fc5999ec46c2bab9645675bdda11b2d9b04 (patch) | |
tree | 5e66b46cf4602efa6f7c8e5e5711b49730d84aaf /util | |
parent | 5d87d2c2e5809fdc48b36a0de7e4a8a31d7cf3db (diff) | |
download | fluxbox_lack-d1292fc5999ec46c2bab9645675bdda11b2d9b04.zip fluxbox_lack-d1292fc5999ec46c2bab9645675bdda11b2d9b04.tar.bz2 |
update from Han
Diffstat (limited to 'util')
-rwxr-xr-x | util/fluxbox-generate_menu | 165 |
1 files changed, 119 insertions, 46 deletions
diff --git a/util/fluxbox-generate_menu b/util/fluxbox-generate_menu index 54dded4..e7746c8 100755 --- a/util/fluxbox-generate_menu +++ b/util/fluxbox-generate_menu | |||
@@ -1,6 +1,8 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | # | ||
2 | # generate_menu for Fluxbox | 3 | # generate_menu for Fluxbox |
3 | # Copyright (c) 2001-2002 Henrik Kinnunen (fluxgen@linuxmail.org) | 4 | # |
5 | # Copyright (c) 2002 Han Boetes <han@mijncomputer.nl> | ||
4 | # | 6 | # |
5 | # Permission is hereby granted, free of charge, to any person obtaining a | 7 | # Permission is hereby granted, free of charge, to any person obtaining a |
6 | # copy of this software and associated documentation files (the "Software"), | 8 | # copy of this software and associated documentation files (the "Software"), |
@@ -19,6 +21,8 @@ | |||
19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | 21 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
20 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
21 | # DEALINGS IN THE SOFTWARE. | 23 | # DEALINGS IN THE SOFTWARE. |
24 | # | ||
25 | # $Id: fluxbox-generate_menu,v 1.10 2002/11/12 19:19:14 fluxgen Exp $ | ||
22 | 26 | ||
23 | [ `id -u` -eq 0 ] && PATH=/bin:/usr/bin/:/usr/local/bin:/usr/X11R6/bin | 27 | [ `id -u` -eq 0 ] && PATH=/bin:/usr/bin/:/usr/local/bin:/usr/X11R6/bin |
24 | 28 | ||
@@ -31,16 +35,17 @@ Usage: fluxbox-generate_menu [-kg] [-o /path] | |||
31 | [-p /path] [-m menu-title] | 35 | [-p /path] [-m menu-title] |
32 | Options: | 36 | Options: |
33 | 37 | ||
34 | -t Favourite terminal. | 38 | -t Favourite terminal |
39 | -b Favourite browser | ||
35 | -k Insert a kde menu | 40 | -k Insert a kde menu |
36 | -g Add a gnome menu | 41 | -g Add a gnome menu |
37 | -o Outputfile; default is ~/.fluxbox/menu | 42 | -o Outputfile; default is ~/.fluxbox/menu |
38 | -m Menu-title; default is "Fluxbox" | 43 | -m Menu-title; default is "Fluxbox" |
39 | 44 | -r Don't remove empty menu-entries; Better for templates. | |
40 | -h Display this help | 45 | -h Display this help |
41 | -a Display the authors of this script | 46 | -a Display the authors of this script |
42 | 47 | ||
43 | only for packagers: | 48 | Only for packagers: |
44 | 49 | ||
45 | -p Package-datadir; default is /usr/share | 50 | -p Package-datadir; default is /usr/share |
46 | -n Gnome-datadir; default is Package-datadir | 51 | -n Gnome-datadir; default is Package-datadir |
@@ -87,13 +92,15 @@ append_menu() { | |||
87 | } | 92 | } |
88 | 93 | ||
89 | append_submenu() { | 94 | append_submenu() { |
90 | echo >> ${FILENAME} | 95 | # empty line for readability |
96 | [ ${REMOVE} ] && echo >> ${FILENAME} | ||
91 | append_menu "[submenu] ($1)" | 97 | append_menu "[submenu] ($1)" |
92 | } | 98 | } |
93 | 99 | ||
94 | append_menu_end() { | 100 | append_menu_end() { |
95 | append_menu "[end]" | 101 | append_menu "[end]" |
96 | echo >> ${FILENAME} | 102 | # empty line for readability |
103 | [ ${REMOVE} ] && echo >> ${FILENAME} | ||
97 | } | 104 | } |
98 | 105 | ||
99 | menu_entry() { | 106 | menu_entry() { |
@@ -120,18 +127,28 @@ normal_find() { | |||
120 | done | 127 | done |
121 | } | 128 | } |
122 | 129 | ||
130 | clean_up() { | ||
131 | # -e "/^$/d" -e "/^$/d" | ||
132 | cat ${FILENAME} | sed -e "/^\[submenu]/{ | ||
133 | N | ||
134 | /^\[submenu].*\n\[end]/d | ||
135 | }" > ${FILENAME}.tmp | ||
136 | mv -f ${FILENAME}.tmp ${FILENAME} | ||
137 | } | ||
123 | 138 | ||
124 | # Get options. | 139 | # Get options. |
125 | while getopts ":khagt:p:n:q:o:m:" COMMAND_LINE_ARGUMENT ; do | 140 | while getopts ":khragb:t:p:n:q:o:m:" COMMAND_LINE_ARGUMENT ; do |
126 | case "${COMMAND_LINE_ARGUMENT}" in | 141 | case "${COMMAND_LINE_ARGUMENT}" in |
127 | k) KDEMENU=yes ;; | 142 | k) KDEMENU=yes ;; |
128 | g) GNOMEMENU=yes ;; | 143 | g) GNOMEMENU=yes ;; |
129 | t) MY_TERM=${OPTARG};; | 144 | t) MY_TERM=${OPTARG};; |
145 | b) MY_BROWSER=${OPTARG};; | ||
130 | o) FILENAME=${OPTARG} ;; | 146 | o) FILENAME=${OPTARG} ;; |
131 | p) PKGDATADIR=${OPTARG} ;; | 147 | p) PKGDATADIR=${OPTARG} ;; |
132 | n) GPKGDATADIR=${OPTARG} ;; | 148 | n) GPKGDATADIR=${OPTARG} ;; |
133 | q) KPKGDATADIR=${OPTARG} ;; | 149 | q) KPKGDATADIR=${OPTARG} ;; |
134 | m) MENUTITLE=${OPTARG} ;; | 150 | m) MENUTITLE=${OPTARG} ;; |
151 | r) REMOVE=no ;; | ||
135 | h) display_usage ; exit 0 ;; | 152 | h) display_usage ; exit 0 ;; |
136 | a) display_authors ; exit 0 ;; | 153 | a) display_authors ; exit 0 ;; |
137 | *) display_help ; exit 1 ;; | 154 | *) display_help ; exit 1 ;; |
@@ -154,12 +171,19 @@ fi | |||
154 | 171 | ||
155 | # backup menu | 172 | # backup menu |
156 | if [ -w ${FILENAME} ]; then | 173 | if [ -w ${FILENAME} ]; then |
174 | if [ -f ${FILENAME}.firstbak ];then | ||
175 | cp ${FILENAME} ${FILENAME}.firstbak | ||
176 | fi | ||
157 | mv ${FILENAME} ${FILENAME}.bak | 177 | mv ${FILENAME} ${FILENAME}.bak |
158 | fi | 178 | fi |
159 | 179 | ||
160 | #packagedatadir | 180 | #packagedatadir |
161 | if [ ! -d "${PKGDATADIR}" ]; then | 181 | if [ ! -d "${PKGDATADIR}" ]; then |
162 | PKGDATADIR=/usr/share | 182 | if [ `uname` = "Linux" ];then |
183 | PKGDATADIR=/usr/share | ||
184 | else | ||
185 | PKGDATADIR=/usr/local/share | ||
186 | fi | ||
163 | fi | 187 | fi |
164 | 188 | ||
165 | #gnome packagedatadir | 189 | #gnome packagedatadir |
@@ -193,6 +217,21 @@ else | |||
193 | fi | 217 | fi |
194 | 218 | ||
195 | 219 | ||
220 | # find the default browser | ||
221 | find_it $MY_BROWSER | ||
222 | if [ $? -ne 0 ];then | ||
223 | [ -n "$MY_BROWSER" ] && echo "Warning: you choose an invalid browser." > /dev/stderr | ||
224 | #The precise order is up for debate. | ||
225 | for browser in opera phoenix mozilla galeon konqueror dillo netscape links w3m lynx; do | ||
226 | if find_it $browser; then | ||
227 | DEFAULT_BROWSER=$browser | ||
228 | break | ||
229 | fi | ||
230 | done | ||
231 | else | ||
232 | DEFAULT_BROWSER=$MY_BROWSER | ||
233 | fi | ||
234 | |||
196 | 235 | ||
197 | # a unix system without any terms. that's odd | 236 | # a unix system without any terms. that's odd |
198 | if [ -z "$DEFAULT_TERM" ];then | 237 | if [ -z "$DEFAULT_TERM" ];then |
@@ -387,64 +426,77 @@ echo "[begin] (${MENUTITLE})" > ${FILENAME} | |||
387 | 426 | ||
388 | 427 | ||
389 | append "[exec] (${DEFAULT_TERM}) {${DEFAULT_TERM}}" | 428 | append "[exec] (${DEFAULT_TERM}) {${DEFAULT_TERM}}" |
390 | find_it nedit append "[exec] (nedit) {nedit}" | ||
391 | 429 | ||
430 | case "$DEFAULT_BROWSER" in | ||
431 | links|w3m|lynx) append "[exec] (${DEFAULT_BROWSER}) {${DEFAULT_TERM} -e ${DEFAULT_BROWSER} fluxbox.org}" ;; | ||
432 | mozilla|phoenix|galeon|dillo|netscape) append "[exec] (${DEFAULT_BROWSER}) {${DEFAULT_BROWSER}}" ;; | ||
433 | konqueror) append "[exec] (konqueror) {kfmclient openProfile webbrowsing}" ;; | ||
434 | opera) append "[exec] (opera) {env QT_XFT=true opera}" ;; | ||
435 | esac | ||
392 | 436 | ||
393 | append_submenu ${TERMINALMENU} | 437 | find_it fbrun append "[exec] (Run) {fbrun}" |
394 | normal_find xterm gnome-terminal Eterm konsole aterm rxvt | ||
395 | append_menu_end | ||
396 | 438 | ||
397 | 439 | ||
398 | append_submenu ${EDITORMENU} | 440 | append_submenu ${TERMINALMENU} |
399 | normal_find nedit gvim xemacs emacs gedit xedit kword kwrite kate | 441 | normal_find xterm gnome-terminal Eterm konsole aterm rxvt |
400 | append_menu_end | 442 | append_menu_end |
401 | 443 | ||
402 | 444 | ||
403 | append_submenu ${BROWSERMENU} | 445 | append_submenu ${NETMENU} |
404 | normal_find netscape galeon mozilla dillo | 446 | append_submenu ${BROWSERMENU} |
447 | normal_find netscape galeon mozilla dillo | ||
405 | find_it opera append "[exec] (opera) {env QT_XFT=true opera}" | 448 | find_it opera append "[exec] (opera) {env QT_XFT=true opera}" |
406 | find_it konqueror append "[exec] (konqueror) {kfmclient openProfile webbrowsing}" | 449 | find_it konqueror append "[exec] (konqueror) {kfmclient openProfile webbrowsing}" |
407 | find_it links append "[exec] (links) {${DEFAULT_TERM} -e links fluxbox.org}" | 450 | find_it links append "[exec] (links) {${DEFAULT_TERM} -e links fluxbox.org}" |
408 | find_it w3m append "[exec] (w3m) {${DEFAULT_TERM} -e w3m fluxbox.org}" | 451 | find_it w3m append "[exec] (w3m) {${DEFAULT_TERM} -e w3m fluxbox.org}" |
409 | find_it lynx append "[exec] (lynx) {${DEFAULT_TERM} -e lynx fluxbox.org}" | 452 | find_it lynx append "[exec] (lynx) {${DEFAULT_TERM} -e lynx fluxbox.org}" |
453 | append_menu_end | ||
454 | |||
455 | append_submenu IM | ||
456 | normal_find gaim kopete gnomemeeting | ||
457 | find_it licq append "[exec] (licq) {env QT_XFT=true licq}" | ||
458 | append_menu_end | ||
459 | |||
460 | append_submenu Mail | ||
461 | normal_find sylpheed kmail evolution | ||
462 | find_it mutt append "[exec] (mutt) {${DEFAULT_TERM} -e mutt}" | ||
463 | append_menu_end | ||
464 | |||
465 | append_submenu IRC | ||
466 | normal_find xchat | ||
467 | find_it irssi append "[exec] (irssi) {${DEFAULT_TERM} -e irssi}" | ||
468 | find_it BitchX append "[exec] (BitchX) {${DEFAULT_TERM} -e BitchX -N}" | ||
469 | [ $? -ne 0 ] && \ | ||
470 | find_it bitchx append "[exec] (BitchX) {${DEFAULT_TERM} -e bitchx -N}" | ||
471 | find_it ircii append "[exec] (ircii) {${DEFAULT_TERM} -e ircii -s}" | ||
472 | append_menu_end | ||
473 | |||
474 | normal_find gftp pan | ||
410 | append_menu_end | 475 | append_menu_end |
411 | 476 | ||
412 | 477 | ||
413 | append_submenu ${NETMENU} | 478 | append_submenu ${EDITORMENU} |
414 | normal_find realplay gaim sylpheed kmail gnomemeeting evolution gftp pan xchat kopete | 479 | normal_find nedit gvim xemacs emacs gedit xedit kword kwrite kate |
415 | find_it licq append "[exec] (licq) {env QT_XFT=true licq}" | ||
416 | find_it mutt append "[exec] (mutt) {${DEFAULT_TERM} -e mutt}" | ||
417 | find_it irssi append "[exec] (irssi) {${DEFAULT_TERM} -e irssi}" | ||
418 | find_it BitchX append "[exec] (BitchX) {${DEFAULT_TERM} -e BitchX -N}" | ||
419 | [ $? -ne 0 ] && \ | ||
420 | find_it bitchx append "[exec] (BitchX) {${DEFAULT_TERM} -e bitchx -N}" | ||
421 | find_it ircii append "[exec] (ircii) {${DEFAULT_TERM} -e ircii -s}" | ||
422 | append_menu_end | 480 | append_menu_end |
423 | 481 | ||
424 | 482 | ||
425 | append_submenu ${MULTIMEDIAMENU} | 483 | append_submenu ${MULTIMEDIAMENU} |
426 | append_submenu ${GRAPHICMENU} | 484 | append_submenu ${GRAPHICMENU} |
427 | normal_find gimp xv gqview xpaint kpaint kiconedit xscreensaver-demo | 485 | normal_find gimp xv gqview xpaint kpaint kiconedit xscreensaver-demo |
428 | find_it gears append "[exec] (Mesa gears) {gears}" | 486 | find_it gears append "[exec] (Mesa gears) {gears}" |
429 | find_it morph3d append "[exec] (Mesa morph) {morph3d}" | 487 | find_it morph3d append "[exec] (Mesa morph) {morph3d}" |
430 | find_it reflect append "[exec] (Mesa reflect) {reflect}" | 488 | find_it reflect append "[exec] (Mesa reflect) {reflect}" |
431 | append_menu_end | 489 | append_menu_end |
432 | 490 | ||
433 | append_submenu ${MUSICMENU} | 491 | append_submenu ${MUSICMENU} |
434 | normal_find xmms gqmpeg xmixer gmix kmix grecord \ | 492 | normal_find xmms gqmpeg xmixer gmix kmix grecord \ |
435 | kmidi xplaycd soundtracker grip | 493 | kmidi xplaycd soundtracker grip easytag |
436 | find_it cplay append "[exec] (cplay) {${DEFAULT_TERM} -e cplay}" | 494 | find_it cplay append "[exec] (cplay) {${DEFAULT_TERM} -e cplay}" |
437 | append_menu_end | 495 | append_menu_end |
438 | 496 | ||
439 | append_submenu ${GAMESMENU} | ||
440 | normal_find bzflag gnibbles gnobots2 tuxpuck gataxx glines \ | ||
441 | gnect mahjongg gnomine gnome-stones gnometris gnotravex \ | ||
442 | gnotski iagno knights same-gnome xboard freecell pysol \ | ||
443 | gtali tuxracer xpenguins xsnow xeyes xpenguins | ||
444 | append_menu_end | ||
445 | 497 | ||
446 | append_submenu ${MISCMENU} | 498 | append_submenu ${MISCMENU} |
447 | normal_find xine aviplay gtv gmplayer xmovie xcdroast xgdb ddd | 499 | normal_find xine aviplay gtv gmplayer xmovie xcdroast xgdb ddd realplay |
448 | find_it dvdrip append "[exec] (dvdrip) {nohup dvdrip}" | 500 | find_it dvdrip append "[exec] (dvdrip) {nohup dvdrip}" |
449 | append_menu_end | 501 | append_menu_end |
450 | 502 | ||
@@ -464,11 +516,18 @@ append_submenu ${OFFICEMENU} | |||
464 | normal_find abiword kword wordperfect katoob acroread xpdf | 516 | normal_find abiword kword wordperfect katoob acroread xpdf |
465 | append_menu_end | 517 | append_menu_end |
466 | 518 | ||
519 | append_submenu ${GAMESMENU} | ||
520 | normal_find bzflag gnibbles gnobots2 tuxpuck gataxx glines \ | ||
521 | gnect mahjongg gnomine gnome-stones gnometris gnotravex \ | ||
522 | gnotski iagno knights same-gnome xboard freecell pysol \ | ||
523 | gtali tuxracer xpenguins xsnow xeyes xpenguins \ | ||
524 | quake2 quake3 | ||
525 | append_menu_end | ||
467 | 526 | ||
468 | # gnome menu | 527 | # gnome menu |
469 | if [ -d ${GPKGDATADIR}/gnome/apps -a "${GNOMEMENU}" ]; then | 528 | if [ -d ${GPKGDATADIR}/gnome/apps -a "${GNOMEMENU}" ]; then |
470 | append_submenu ${GNOMEMENUTEXT} | 529 | append_submenu ${GNOMEMENUTEXT} |
471 | for a in `ls ${GPKGDATADIR}/gnome/apps`; do | 530 | for a in ${GPKGDATADIR}/gnome/apps/* ; do |
472 | if [ -d ${GPKGDATADIR}/gnome/apps/"${a}" ] ; then | 531 | if [ -d ${GPKGDATADIR}/gnome/apps/"${a}" ] ; then |
473 | append_submenu "${a}" | 532 | append_submenu "${a}" |
474 | menu_entry_dir "${GPKGDATADIR}/gnome/apps/${a}" | 533 | menu_entry_dir "${GPKGDATADIR}/gnome/apps/${a}" |
@@ -482,10 +541,10 @@ fi | |||
482 | # kde submenu | 541 | # kde submenu |
483 | if [ -d ${KPKGDATADIR}/applnk/ -a "${KDEMENU}" ]; then | 542 | if [ -d ${KPKGDATADIR}/applnk/ -a "${KDEMENU}" ]; then |
484 | append_submenu ${KDEMENUTEXT} | 543 | append_submenu ${KDEMENUTEXT} |
485 | for a in `ls ${KPKGDATADIR}/applnk/`; do | 544 | for a in ${KPKGDATADIR}/applnk/* ; do |
486 | if [ -d ${KPKGDATADIR}/applnk/"${a}" ]; then | 545 | if [ -d ${KPKGDATADIR}/applnk/"${a}" ]; then |
487 | append_submenu "${a}" | 546 | append_submenu "${a}" |
488 | for x in `ls ${KPKGDATADIR}/applnk/"${a}"`; do | 547 | for x in ${KPKGDATADIR}/applnk/"${a}"/*; do |
489 | if [ -d ${KPKGDATADIR}/applnk/"${a}"/"${x}" ]; then | 548 | if [ -d ${KPKGDATADIR}/applnk/"${a}"/"${x}" ]; then |
490 | append_submenu "${x}" | 549 | append_submenu "${x}" |
491 | menu_entry_dir ${KPKGDATADIR}/applnk/"${a}"/"${x}" | 550 | menu_entry_dir ${KPKGDATADIR}/applnk/"${a}"/"${x}" |
@@ -500,27 +559,41 @@ if [ -d ${KPKGDATADIR}/applnk/ -a "${KDEMENU}" ]; then | |||
500 | append_menu_end | 559 | append_menu_end |
501 | fi | 560 | fi |
502 | 561 | ||
503 | append_submenu ${FBSETTINGSMENU} | 562 | # append_submenu ${FBSETTINGSMENU} |
504 | append "[workspaces] (${WORKSPACEMENU})" | 563 | append_submenu Fluxbox-menu |
564 | append "[config] (${CONFIGUREMENU})" | ||
565 | |||
505 | 566 | ||
506 | append_menu "[submenu] (${STYLEMENU}) {${STYLEMENUTITLE}}" | 567 | append_menu "[submenu] (${STYLEMENU}) {${STYLEMENUTITLE}}" |
507 | append "[stylesdir] (~/.fluxbox/styles)" | ||
508 | append "[stylesdir] (${PKGDATADIR}/fluxbox/styles)" | 568 | append "[stylesdir] (${PKGDATADIR}/fluxbox/styles)" |
569 | append "[stylesdir] (~/.fluxbox/styles)" | ||
570 | |||
509 | append_menu_end | 571 | append_menu_end |
510 | 572 | ||
511 | append "[config] (${CONFIGUREMENU})" | 573 | append "[workspaces] (${WORKSPACEMENU})" |
512 | append "[reconfig] (${RELOADITEM})" | ||
513 | |||
514 | find_it fluxconf append "[exec] (Fluxconf) {fluxconf}" | ||
515 | 574 | ||
575 | append_submenu Tools | ||
576 | find_it fluxconf append "[exec] (FluxConf) {fluxconf}" | ||
577 | find_it fluxkeys append "[exec] (FluxKeys) {fluxkeys}" | ||
578 | find_it fluxmenu append "[exec] (FluxMenu) {fluxmenu}" | ||
516 | # if gxmessage exitst use it; else use xmessage | 579 | # if gxmessage exitst use it; else use xmessage |
517 | find_it gxmessage append "[exec] (Windowname) {xprop|grep WM_CLASS|cut -d \\\" -f 2|gxmessage -file - -center}" | 580 | find_it gxmessage append "[exec] (Windowname) {xprop|grep WM_CLASS|cut -d \\\" -f 2|gxmessage -file - -center}" |
518 | [ $? -ne 0 ] && \ | 581 | [ $? -ne 0 ] && \ |
519 | find_it xmessage append "[exec] (Windowname) {xprop|grep WM_CLASS|cut -d \\\" -f 2|xmessage -file - -center}" | 582 | find_it xmessage append "[exec] (Windowname) {xprop|grep WM_CLASS|cut -d \\\" -f 2|xmessage -file - -center}" |
583 | find_it fbrun append "[exec] (Run) {fbrun}" | ||
520 | append_menu_end | 584 | append_menu_end |
521 | 585 | ||
586 | append "[reconfig] (${RELOADITEM})" | ||
587 | append "[restart] (${RESTARTITEM})" | ||
588 | append "[exit] (${EXITITEM})" | ||
522 | 589 | ||
523 | append "[restart] (${RESTARTITEM})" | 590 | append_menu_end |
524 | append "[exit] (${EXITITEM})" | ||
525 | 591 | ||
526 | append_menu_end | 592 | append_menu_end |
593 | |||
594 | # this function removes empty menu items. It can not yet remove nested | ||
595 | # empty submenus :\ | ||
596 | |||
597 | if [ ! ${REMOVE} ];then | ||
598 | clean_up | ||
599 | fi | ||