summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdata/fluxbox-generate_menu322
1 files changed, 322 insertions, 0 deletions
diff --git a/data/fluxbox-generate_menu b/data/fluxbox-generate_menu
new file mode 100755
index 0000000..8b0fc30
--- /dev/null
+++ b/data/fluxbox-generate_menu
@@ -0,0 +1,322 @@
1#!/bin/sh
2# generate_menu for Fluxbox
3# Copyright (c) 2001-2002 Henrik Kinnunen (fluxgen@linuxmail.org)
4#
5# Permission is hereby granted, free of charge, to any person obtaining a
6# copy of this software and associated documentation files (the "Software"),
7# to deal in the Software without restriction, including without limitation
8# the rights to use, copy, modify, merge, publish, distribute, sublicense,
9# and/or sell copies of the Software, and to permit persons to whom the
10# Software is furnished to do so, subject to the following conditions:
11#
12# The above copyright notice and this permission notice shall be included in
13# all copies or substantial portions of the Software.
14#
15# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19# 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
21# DEALINGS IN THE SOFTWARE.
22
23# Functions
24
25display_usage () {
26 echo
27 echo "fluxbox-generate_menu"
28 echo 'Usage: fluxbox-generate_menu [-kg] [-o /path]'
29 echo ' [-p /path] [-m menu-title]'
30 echo "Options:"
31 echo " -k Insert a kde menu"
32 echo " -g Add a gnome menu"
33 echo " -p Package-datadir; default is /usr/local/share"
34 echo " -o Outputfile; default is ~/.fluxbox/menu"
35 echo ' -m Menu-title; default is "Fluxbox"'
36 echo " -h Display this help"
37 echo " -a Display the authors of this script"
38 echo
39}
40display_help () {
41 echo
42 echo "This program generates a menu-file for fluxbox."
43 echo "Use fluxbox-generate_menu -h for brief usage instructions"
44 echo
45}
46
47display_authors () {
48 echo
49 echo "This program was brought to you by:"
50 echo
51 echo "Henrik Kinnunnen: Project leader."
52 echo "Han Boetes: Packaging, debugging and scripts."
53 echo "Jeramy B. Smith: Packaging assistance, gnome and kde menu system."
54 echo "Xyrnix: Mysterious guest developer who made find_it module."
55 echo `whoami`": Innocent bystander."
56 echo
57}
58
59find_it() {
60 _it="`which \"$1\" 2>/dev/null | grep \"^/.*$1\"`"
61 if [ ! -z "$_it" ]; then
62 if [ -x "$_it" ]; then
63 shift
64 $*
65 else
66 echo "$1 exists but it is not executable! Check permissions."
67 fi
68 fi
69}
70
71append() {
72 echo " $*" >> $FILENAME
73}
74
75append_menu() {
76 echo "$*" >> $FILENAME
77}
78
79append_submenu() {
80 echo >> $FILENAME
81 append_menu "[submenu] ($1)"
82}
83
84append_menu_end() {
85 append_menu "[end]"
86 echo >> $FILENAME
87}
88
89menu_entry() {
90 append "[exec] ("`grep -v GenericName $* | grep Name= | cut -d = -f 2`") \
91 {"`grep -v TryExec $* | grep Exec= | cut -d = -f 2`"}"
92}
93
94menu_entry_dircheck() {
95 if [ -d "$*" ]; then
96 menu_entry_dir "$*"
97 fi
98}
99
100menu_entry_dir() {
101 for b in `ls "$*"/*.desktop 2>/dev/null `; do
102 menu_entry "$b"
103 done
104}
105
106# Get options.
107while getopts ":khagp:o:m:" COMMAND_LINE_ARGUMENT ; do
108
109 case "${COMMAND_LINE_ARGUMENT}" in
110
111 k)
112 KDEMENU=yes
113 ;;
114
115 g)
116 GNOMEMENU=yes
117 ;;
118
119 o)
120 FILENAME=${OPTARG}
121 ;;
122
123 p)
124 PKGDATADIR=${OPTARG}
125 ;;
126
127 m)
128 MENUTITLE=${OPTARG}
129 ;;
130
131 h)
132 display_usage
133 exit 0
134 ;;
135
136 a)
137 display_authors
138 exit 0
139 ;;
140
141 *)
142 display_help
143 exit 1
144 ;;
145
146 esac
147done
148
149
150# Set Defaults
151
152# menufile name and make a backup
153[ ! $FILENAME ] && FILENAME=~/.fluxbox/menu
154[ -e $FILENAME ] && cp -f $FILENAME ${FILENAME}.bak
155
156#packagedatadir
157[ ! $PKGDATADIR ] && PKGDATADIR=/usr/share
158
159# menutitle
160[ ! $MENUTITLE ] && MENUTITLE="Fluxbox"
161
162
163# Start of menu
164
165echo "[begin] ($MENUTITLE)" > $FILENAME
166
167find_it xterm append "[exec] (xterm) {xterm -fg white -bg black}"
168find_it nedit append "[exec] (nedit) {nedit}"
169
170
171append_submenu Browsers
172 find_it netscape append "[exec] (netscape) {netscape}"
173 find_it opera append "[exec] (opera) {env QT_XFT=true opera}"
174 find_it galeon append "[exec] (galeon) {galeon}"
175 find_it mozilla append "[exec] (mozilla) {mozilla}"
176 find_it konqueror append "[exec] (konqueror) {konqueror}"
177 find_it links append "[exec] (links) {xterm -title links -fg white -bg black -e links fluxbox.sf.net}"
178 find_it w3m append "[exec] (w3m) {xterm -title w3m -fg white -bg black -e w3m}"
179append_menu_end
180
181append_submenu Editors
182 find_it nedit append "[exec] (nedit) {nedit}"
183 find_it vim append "[exec] (vim) {vim -g}"
184 find_it xemacs append "[exec] (xemacs) {xemacs}"
185 find_it gedit append "[exec] (gedit) {gedit}"
186 find_it xedit append "[exec] (xedit) {xedit}"
187 find_it kword append "[exec] (kword) {kword}"
188 find_it kwrite append "[exec] (kwrite) {kwrite}"
189append_menu_end
190
191append_submenu Net
192 find_it realplay append "[exec] (realplayer) {realplay}"
193 find_it licq append "[exec] (licq) {env QT_XFT=true licq}"
194 find_it gaim append "[exec] (gaim) {gaim}"
195 find_it sylpheed append "[exec] (sylpheed) {sylpheed}"
196 find_it evolution append "[exec] (evolution) {evolution}"
197 find_it mutt append "[exec] (mutt) {xterm -title mutt -fg white -bg black -e mutt}"
198
199 find_it gftp append "[exec] (gftp) {gftp}"
200 find_it xchat append "[exec] (xchat) {xchat}"
201 find_it irssi append "[exec] (irssi) {xterm -title irssi -e irssi}"
202 find_it BitchX append "[exec] (BitchX) {xterm -title BitchX -fg white -bg black -e BitchX -N}"
203 find_it bitchx append "[exec] (BitchX) {xterm -title BitchX -fg white -bg black -e bitchx -N}"
204 find_it ircii append "[exec] (ircii) {xterm -title ircii -fg white -bg black -e ircii -s}"
205append_menu_end
206
207append_submenu Graphics
208 find_it gimp append "[exec] (gimp) {gimp}"
209 find_it xv append "[exec] (xv) {xv}"
210 find_it gqview append "[exec] (gqview) {gqview}"
211 find_it xpaint append "[exec] (xpaint) {xpaint}"
212 find_it kpaint append "[exec] (kpaint) {kpaint}"
213 find_it kiconedit append "[exec] (kiconedit) {kiconedit}"
214 find_it xscreensaver-demo append "[exec] (xscreensaver-demo) {xscreensaver-demo}"
215append_menu_end
216
217append_submenu Music
218 find_it xmms append "[exec] (xmms) {xmms}"
219 find_it gqmpeg append "[exec] (gqmpeg) {gqmpeg}"
220 find_it xmixer append "[exec] (xmixer) {xmixer}"
221 find_it gmix append "[exec] (gmix) {gmix}"
222 find_it kmix append "[exec] (kmix) {kmix}"
223 find_it grecord append "[exec] (grecord) {grecord}"
224 find_it kmidi append "[exec] (kmidi) {kmidi}"
225 find_it xplaycd append "[exec] (xplaycd) {xplaycd}"
226 find_it soundtracker append "[exec] (soundtracker) {soundtracker}"
227 find_it cplay append "[exec] (cplay) {xterm -title cplay -fg white -bg black -e /usr/local/bin/cplay}"
228 find_it grip append "[exec] (grip) {grip}"
229append_menu_end
230
231append_submenu Terminals
232 append "[exec] (xterm) {xterm -fg white -bg black}"
233 find_it gnome-terminal append "[exec] (gnome-terminal) {gnome-terminal}"
234 find_it Eterm append "[exec] (Eterm) {Eterm}"
235 find_it konsole append "[exec] (konsole) {konsole}"
236 find_it aterm append "[exec] (aterm) {aterm}"
237 find_it rxvt append "[exec] (rxvt) {rxvt}"
238append_menu_end
239
240append_submenu Misc
241 find_it acroread append "[exec] (acroread) {acroread}"
242 find_it gcalc append "[exec] (gcalc) {gcalc}"
243 find_it kcalc append "[exec] (kcalc) {kcalc}"
244 find_it kpackage append "[exec] (kpackage) {kpackage}"
245 find_it xgdb append "[exec] (xgdb) {xgdb}"
246 find_it ddd append "[exec] (ddd) {ddd}"
247 find_it xterm append "[exec] (tail access_log) {xterm -fg white -bg black -title access_log -e tail -f /var/log/access_log}"
248append_menu_end
249
250
251append_submenu X-utils
252 find_it xpenguins append "[exec] (xpenguins) {xpenguins}"
253 find_it xcalc append "[exec] (xcalc) {xcalc}"
254 find_it xfontsel append "[exec] (xfontsel) {xfontsel}"
255 find_it xman append "[exec] (xman) {xman}"
256 find_it xload append "[exec] (xload) {xload}"
257 find_it xfig append "[exec] (xfig) {xfig}"
258 find_it xbiff append "[exec] (xbiff) {xbiff}"
259 find_it editres append "[exec] (editres) {editres}"
260 find_it viewres append "[exec] (viewres) {viewres}"
261 find_it xsnow append "[exec] (xsnow) {xsnow}"
262 find_it xclock append "[exec] (xclock) {xclock}"
263append_menu_end
264
265# gnome menu
266if [ -d $PKGDATADIR/gnome/apps ] && [ $GNOMEMENU ]; then
267 append_submenu Gnome-menus
268 for a in `ls $PKGDATADIR/gnome/apps`; do
269 if [ -d $PKGDATADIR/gnome/apps/"$a" ] ; then
270 append_submenu "$a"
271 menu_entry_dir "$PKGDATADIR/gnome/apps/"$a""
272 menu_entry_dircheck "/etc/X11/applnk/"$a""
273 append_menu_end
274 fi
275 done
276 append_menu_end
277fi
278
279# kde submenu
280if [ -d $PKGDATADIR/applnk/ ] && [ $KDEMENU ]; then
281 append_submenu KDE-menus
282 for a in `ls $PKGDATADIR/applnk/`; do
283 if [ -d $PKGDATADIR/applnk/"$a" ]; then
284 append_submenu "$a"
285 for x in `ls $PKGDATADIR/applnk/"$a"`; do
286 if [ -d $PKGDATADIR/applnk/"$a"/"$x" ]; then
287 append_submenu "$x"
288 menu_entry_dir $PKGDATADIR/applnk/"$a"/"$x"
289 append_menu_end
290 fi
291 done
292 menu_entry_dir $PKGDATADIR/applnk/"$a"
293 append_menu_end
294 fi
295 done
296 menu_entry_dir $PKGDATADIR/applnk/
297 append_menu_end
298fi
299
300
301append_submenu Settings
302 append "[workspaces] (Workspace List)"
303
304 append_menu "[submenu] (Styles) {Choose a style...}"
305 append "[stylesdir] ($PKGDATADIR/fluxbox/styles)"
306 append "[stylesdir] (~/.fluxbox/styles)"
307 append_menu_end
308
309 append "[config] (Configuration)"
310 append "[reconfig] (Reload config)"
311
312 find_it fluxconf append "[exec] (Fluxconf) {fluxconf}"
313
314append_menu_end
315
316 append "[restart] (Restart)"
317 append "[exit] (Exit)"
318
319append_menu_end
320
321
322