summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xutil/fluxbox-generate_menu139
1 files changed, 110 insertions, 29 deletions
diff --git a/util/fluxbox-generate_menu b/util/fluxbox-generate_menu
index 84ca9c6..97b20fc 100755
--- a/util/fluxbox-generate_menu
+++ b/util/fluxbox-generate_menu
@@ -22,7 +22,7 @@
22# 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
23# DEALINGS IN THE SOFTWARE. 23# DEALINGS IN THE SOFTWARE.
24# 24#
25# $Id: fluxbox-generate_menu,v 1.21 2002/12/20 09:02:02 fluxgen Exp $ 25# $Id: fluxbox-generate_menu,v 1.22 2002/12/29 10:37:47 fluxgen Exp $
26 26
27WHOAMI=`whoami` 27WHOAMI=`whoami`
28[ "$WHOAMI" = "root" ] && PATH=/bin:/usr/bin/:/usr/local/bin:/usr/X11R6/bin 28[ "$WHOAMI" = "root" ] && PATH=/bin:/usr/bin/:/usr/local/bin:/usr/X11R6/bin
@@ -51,18 +51,22 @@ Options:
51 -t Favourite terminal 51 -t Favourite terminal
52 -b Favourite browser 52 -b Favourite browser
53 -w Homepage for console-browsers. Default is fluxbox.org. 53 -w Homepage for console-browsers. Default is fluxbox.org.
54 -u user sub-menu 54 -u user sub-menu; default is ~/.fluxbox/usermenu
55 55
56 -h Display this help 56 -h Display this help
57 -a Display the authors of this script 57 -a Display the authors of this script
58 58
59
60 Only for packagers: 59 Only for packagers:
61 60
62 -p Package-datadir; default is /usr/share 61 -p Package-datadir; default is /usr/share
63 -n Gnome-datadir; default is Package-datadir 62 -n Gnome-datadir; default is Package-datadir
64 -q KDE-datadir; default is Package-datadir 63 -q KDE-datadir; default is Package-datadir
65 64
65
66Files:
67 ~/.fluxbux/usermenu your own file which can be included in the menu
68 ~/.fluxbox/menuconfig rc file for fluxbox-generate_menu
69
66EOF 70EOF
67} 71}
68 72
@@ -81,6 +85,7 @@ fluxbox-generate_menu was brought to you by:
81EOF 85EOF
82} 86}
83 87
88# ugly code for solaris compat.
84find_it() { 89find_it() {
85 file=`which $1 2> /dev/null` 90 file=`which $1 2> /dev/null`
86 if [ -x "$file" ]; then 91 if [ -x "$file" ]; then
@@ -103,15 +108,13 @@ append_menu() {
103} 108}
104 109
105append_submenu() { 110append_submenu() {
106 # only an empty line in templates 111 [ "${REMOVE}" ] && echo >> ${FILENAME} # only an empty line in templates
107 [ "${REMOVE}" ] && echo >> ${FILENAME}
108 append_menu "[submenu] ($1)" 112 append_menu "[submenu] ($1)"
109} 113}
110 114
111append_menu_end() { 115append_menu_end() {
112 append_menu "[end]" 116 append_menu "[end]"
113 # only an empty line in templates 117 [ "${REMOVE}" ] && echo >> ${FILENAME} # only an empty line in templates
114 [ "${REMOVE}" ] && echo >> ${FILENAME}
115} 118}
116 119
117menu_entry() { 120menu_entry() {
@@ -147,15 +150,70 @@ N
147mv -f ${FILENAME}.tmp ${FILENAME} 150mv -f ${FILENAME}.tmp ${FILENAME}
148} 151}
149 152
150# Save options for inclusion in menu
151options="$@"
152
153# Set Defaults 153# Set Defaults
154FILENAME="${HOME}/.fluxbox/menu" 154FILENAME="${HOME}/.fluxbox/menu"
155MENUTITLE="Fluxbox" 155MENUTITLE="Fluxbox"
156HOMEPAGE="fluxbox.org" 156HOMEPAGE="fluxbox.org"
157USERMENU="${HOME}/.fluxbox/usermenu" 157USERMENU="${HOME}/.fluxbox/usermenu"
158 158
159# Read the menuconfig file if it exists or else create it.
160if [ -e ${HOME}/.fluxbox/menuconfig ];then
161 . ${HOME}/.fluxbox/menuconfig
162else
163 if [ ! "$WHOAMI" = root ];then # this is only for users.
164 cat<<EOF> ${HOME}/.fluxbox/menuconfig
165# This file is read by fluxbox-generate_menu. If you don't like a
166# default you can change it here. Don't forget to remove the # in front
167# of the line.
168
169# Your favourite terminal
170# MY_TERM=aterm
171
172# Your favourite browser
173# MY_BROWSER=mozilla
174
175# Name of the outputfile
176# FILENAME=${HOME}/.fluxbox/menu
177
178# Data-dir
179# PKGDATADIR=/usr/share
180
181# Gnome data-dir
182# in case gnome is installed in another datadir.
183# GPKGDATADIR=/opt/gnome/share
184
185# Kde data-dir
186# KPKGDATADIR=/opt/kde/share
187
188# MENUTITLE=Fluxbox 0.1.14
189
190# standard url for console-browsers
191# HOMEPAGE=fluxbox.org
192
193# location with your own menu-entries
194# USERMENU=~/.fluxbox/usermenu
195
196# Boolean variables.
197# Setting a variable to no won't help. Comment them out if you don't want them.
198# Setting are overruled by the command-line options.
199
200# Include all backgrounds in your backgrounds-directory
201# BACKGROUNDMENUITEM=yes
202
203# Include kde-menus
204# KDEMENU=yes
205
206# Include gnome-menus
207# GNOMEMENU=yes
208
209# Don't cleanup the menu
210# REMOVE=no
211
212EOF
213 fi
214fi
215
216
159# Get options. 217# Get options.
160while getopts ":Bkhragb:t:p:w:u:n:q:o:m:" COMMAND_LINE_ARGUMENT ; do 218while getopts ":Bkhragb:t:p:w:u:n:q:o:m:" COMMAND_LINE_ARGUMENT ; do
161 case "${COMMAND_LINE_ARGUMENT}" in 219 case "${COMMAND_LINE_ARGUMENT}" in
@@ -195,10 +253,7 @@ if [ -w "${FILENAME}" ]; then
195 mv ${FILENAME} ${FILENAME}.bak 253 mv ${FILENAME} ${FILENAME}.bak
196fi 254fi
197 255
198# default homepage for console-browsers 256# packagedatadir
199HOMEPAGE=${HOMEPAGE:=fluxbox.org}
200
201#packagedatadir
202if [ ! -d "${PKGDATADIR}" -o "${PKGDATADIR}" = "" ]; then 257if [ ! -d "${PKGDATADIR}" -o "${PKGDATADIR}" = "" ]; then
203 if [ "`uname`" = "Linux" ];then 258 if [ "`uname`" = "Linux" ];then
204 PKGDATADIR=/usr/share 259 PKGDATADIR=/usr/share
@@ -207,12 +262,12 @@ if [ ! -d "${PKGDATADIR}" -o "${PKGDATADIR}" = "" ]; then
207 fi 262 fi
208fi 263fi
209 264
210#gnome packagedatadir 265# gnome packagedatadir
211if [ ! -d "${GPKGDATADIR}" -o "${GPKGDATADIR}" = "" ]; then 266if [ ! -d "${GPKGDATADIR}" -o "${GPKGDATADIR}" = "" ]; then
212 GPKGDATADIR=${PKGDATADIR} 267 GPKGDATADIR=${PKGDATADIR}
213fi 268fi
214 269
215#kde packagedatadir 270# kde packagedatadir
216if [ ! -d "${KPKGDATADIR}" -o "${KPKGDATADIR}" = "" ]; then 271if [ ! -d "${KPKGDATADIR}" -o "${KPKGDATADIR}" = "" ]; then
217 KPKGDATADIR=${PKGDATADIR} 272 KPKGDATADIR=${PKGDATADIR}
218fi 273fi
@@ -239,7 +294,7 @@ find_it $MY_BROWSER
239if [ $? -ne 0 ];then 294if [ $? -ne 0 ];then
240 [ -n "$MY_BROWSER" ] && echo "Warning: you choose an invalid browser." >&2 295 [ -n "$MY_BROWSER" ] && echo "Warning: you choose an invalid browser." >&2
241 #The precise order is up for debate. 296 #The precise order is up for debate.
242 for browser in opera phoenix mozilla galeon konqueror dillo netscape links w3m lynx; do 297 for browser in opera skipstone phoenix mozilla galeon konqueror dillo netscape links w3m lynx; do
243 if find_it $browser; then 298 if find_it $browser; then
244 DEFAULT_BROWSER=$browser 299 DEFAULT_BROWSER=$browser
245 break 300 break
@@ -479,6 +534,32 @@ case ${LC_ALL} in
479 WORKSPACEMENU="Aree di lavoro" 534 WORKSPACEMENU="Aree di lavoro"
480 XUTILSMENU="X-utils" 535 XUTILSMENU="X-utils"
481 ;; 536 ;;
537 ro_RO*) # Romanian locales
538 #OFFICEMENU="Office"
539 #RESTARTITEM="Restart"
540 BACKGROUNDMENU="Fundaluri"
541 BACKGROUNDMENUTITLE="Alege fundalul"
542 BROWSERMENU="Navigatoare"
543 CONFIGUREMENU="Configurare"
544 EDITORMENU="Editoare"
545 EXITITEM="Iesire"
546 FBSETTINGSMENU="Meniul Fluxbox"
547 GAMESMENU="Jocuri"
548 GNOMEMENUTEXT="Meniu Gnome"
549 GRAPHICMENU="Grafica"
550 KDEMENUTEXT="Meniu KDE"
551 MISCMENU="Diverse"
552 MULTIMEDIAMENU="Multimedia"
553 MUSICMENU="Muzica"
554 NETMENU="Net"
555 RELOADITEM="Reincarca configuratia"
556 STYLEMENUTITLE="Alege un stil..."
557 SYSTEMSTYLES="Stiluri sistem"
558 TERMINALMENU="Terminale"
559 USERSTYLES="Stiluri utilizator"
560 WORKSPACEMENU="Lista workspace-uri"
561 XUTILSMENU="Utilitare X"
562 ;;
482 *) 563 *)
483 ;; 564 ;;
484esac 565esac
@@ -548,9 +629,8 @@ append_submenu "${NETMENU}"
548 append_submenu IRC 629 append_submenu IRC
549 normal_find xchat 630 normal_find xchat
550 find_it irssi append "[exec] (irssi) {${DEFAULT_TERM} -e irssi}" 631 find_it irssi append "[exec] (irssi) {${DEFAULT_TERM} -e irssi}"
551 find_it BitchX append "[exec] (BitchX) {${DEFAULT_TERM} -e BitchX -N}" 632 find_it BitchX append "[exec] (BitchX) {${DEFAULT_TERM} -e BitchX -N}" || \
552 [ $? -ne 0 ] && \ 633 find_it bitchx append "[exec] (BitchX) {${DEFAULT_TERM} -e bitchx -N}"
553 find_it bitchx append "[exec] (BitchX) {${DEFAULT_TERM} -e bitchx -N}"
554 find_it ircii append "[exec] (ircii) {${DEFAULT_TERM} -e ircii -s}" 634 find_it ircii append "[exec] (ircii) {${DEFAULT_TERM} -e ircii -s}"
555 append_menu_end 635 append_menu_end
556 636
@@ -572,9 +652,11 @@ append_submenu "${MULTIMEDIAMENU}"
572 append_menu_end 652 append_menu_end
573 653
574 append_submenu "${MUSICMENU}" 654 append_submenu "${MUSICMENU}"
575 normal_find xmms gqmpeg xmixer gmix kmix grecord \ 655 normal_find xmms noatun alsaplayer gqmpeg aumix xmixer gmix kmix grecord \
576 kmidi xplaycd soundtracker grip easytag lopster 656 kmidi xplaycd soundtracker grip easytag lopster audacity
657 find_it cdcd append "[exec] (cdcd) {${DEFAULT_TERM} -e cdcd}"
577 find_it cplay append "[exec] (cplay) {${DEFAULT_TERM} -e cplay}" 658 find_it cplay append "[exec] (cplay) {${DEFAULT_TERM} -e cplay}"
659 find_it alsamixer append "[exec] (AlsaMixer) {${DEFAULT_TERM} -e alsamixer}"
578 append_menu_end 660 append_menu_end
579 661
580 662
@@ -591,8 +673,7 @@ append_menu_end
591 673
592append_submenu "${OFFICEMENU}" 674append_submenu "${OFFICEMENU}"
593 normal_find xclock xcalc kcalc 675 normal_find xclock xcalc kcalc
594 find_it gcalc append "[exec] (gcalc) {gcalc}" 676 find_it gcalc append "[exec] (gcalc) {gcalc}" || \
595 [ $? -ne 0 ] && \
596 find_it gnome-calculator append "[exec] (gcalc) {gnome-calculator}" 677 find_it gnome-calculator append "[exec] (gcalc) {gnome-calculator}"
597 find_it ooffice append "[exec] (Open Office) {ooffice}" 678 find_it ooffice append "[exec] (Open Office) {ooffice}"
598 find_it soffice append "[exec] (Star Office) {soffice}" 679 find_it soffice append "[exec] (Star Office) {soffice}"
@@ -604,7 +685,7 @@ append_submenu "${GAMESMENU}"
604 gnect mahjongg gnomine gnome-stones gnometris gnotravex \ 685 gnect mahjongg gnomine gnome-stones gnometris gnotravex \
605 gnotski iagno knights same-gnome xboard freecell pysol \ 686 gnotski iagno knights same-gnome xboard freecell pysol \
606 gtali tuxracer xpenguins xsnow xeyes xpenguins \ 687 gtali tuxracer xpenguins xsnow xeyes xpenguins \
607 quake2 quake3 688 quake2 quake3 skoosh
608append_menu_end 689append_menu_end
609 690
610# gnome menu 691# gnome menu
@@ -674,12 +755,12 @@ append_submenu "${FBSETTINGSMENU}"
674 find_it fluxmenu append "[exec] (FluxMenu) {fluxmenu}" 755 find_it fluxmenu append "[exec] (FluxMenu) {fluxmenu}"
675 # if gxmessage exitst use it; else use xmessage 756 # if gxmessage exitst use it; else use xmessage
676 find_it gxmessage append \ 757 find_it gxmessage append \
677 "[exec] (Windowname) {xprop|grep WM_CLASS|cut -d \\\" -f 2|gxmessage -file - -center}" 758 "[exec] (Windowname) {xprop|grep WM_CLASS|cut -d \\\" -f 2|gxmessage -file - -center}" || \
678 [ $? -ne 0 ] && \
679 find_it xmessage append \ 759 find_it xmessage append \
680 "[exec] (Windowname) {xprop|grep WM_CLASS|cut -d \\\" -f 2|xmessage -file - -center}" 760 "[exec] (Windowname) {xprop|grep WM_CLASS|cut -d \\\" -f 2|xmessage -file - -center}"
681 find_it fbrun append "[exec] (Run) {fbrun}" 761 find_it import append "[exec] (screenshot) {import screenshot.png && qiv -W 50 screenshot.png}"
682 find_it fluxbox-generate_menu append "[exec] (Regen menu) {fluxbox-generate_menu $options}" 762 find_it fbrun append "[exec] (Run) {fbrun}"
763 find_it fluxbox-generate_menu append "[exec] (Regen menu) {fluxbox-generate_menu}"
683 append_menu_end 764 append_menu_end
684 765
685 append "[reconfig] (${RELOADITEM})" 766 append "[reconfig] (${RELOADITEM})"