aboutsummaryrefslogtreecommitdiff
path: root/data/fluxbox-generate_menu
diff options
context:
space:
mode:
Diffstat (limited to 'data/fluxbox-generate_menu')
-rwxr-xr-xdata/fluxbox-generate_menu333
1 files changed, 333 insertions, 0 deletions
diff --git a/data/fluxbox-generate_menu b/data/fluxbox-generate_menu
new file mode 100755
index 0000000..6f40320
--- /dev/null
+++ b/data/fluxbox-generate_menu
@@ -0,0 +1,333 @@
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
153if [ -z ${FILENAME} ]; then
154 FILENAME=~/.fluxbox/menu
155fi
156
157if [ ! -z ${FILENAME} ]; then
158 if [ -w ${FILENAME} ]; then
159 cp -f ${FILENAME} ${FILENAME}.bak
160 fi
161fi
162
163#packagedatadir
164if [ -z "${PKGDATADIR}" ]; then
165 PKGDATADIR=/usr/share
166fi
167
168# menutitle
169if [ -z "${MENUTITLE}" ]; then
170 MENUTITLE="Fluxbox"
171fi
172
173
174# Start of menu
175
176echo "[begin] ($MENUTITLE)" > ${FILENAME}
177
178find_it xterm append "[exec] (xterm) {xterm -fg white -bg black}"
179find_it nedit append "[exec] (nedit) {nedit}"
180
181
182append_submenu Browsers
183 find_it netscape append "[exec] (netscape) {netscape}"
184 find_it opera append "[exec] (opera) {env QT_XFT=true opera}"
185 find_it galeon append "[exec] (galeon) {galeon}"
186 find_it mozilla append "[exec] (mozilla) {mozilla}"
187 find_it konqueror append "[exec] (konqueror) {konqueror}"
188 find_it links append "[exec] (links) {xterm -title links -fg white -bg black -e links fluxbox.sf.net}"
189 find_it w3m append "[exec] (w3m) {xterm -title w3m -fg white -bg black -e w3m}"
190append_menu_end
191
192append_submenu Editors
193 find_it nedit append "[exec] (nedit) {nedit}"
194 find_it vim append "[exec] (vim) {vim -g}"
195 find_it xemacs append "[exec] (xemacs) {xemacs}"
196 find_it gedit append "[exec] (gedit) {gedit}"
197 find_it xedit append "[exec] (xedit) {xedit}"
198 find_it kword append "[exec] (kword) {kword}"
199 find_it kwrite append "[exec] (kwrite) {kwrite}"
200append_menu_end
201
202append_submenu Net
203 find_it realplay append "[exec] (realplayer) {realplay}"
204 find_it licq append "[exec] (licq) {env QT_XFT=true licq}"
205 find_it gaim append "[exec] (gaim) {gaim}"
206 find_it sylpheed append "[exec] (sylpheed) {sylpheed}"
207 find_it evolution append "[exec] (evolution) {evolution}"
208 find_it mutt append "[exec] (mutt) {xterm -title mutt -fg white -bg black -e mutt}"
209
210 find_it gftp append "[exec] (gftp) {gftp}"
211 find_it xchat append "[exec] (xchat) {xchat}"
212 find_it irssi append "[exec] (irssi) {xterm -title irssi -e irssi}"
213 find_it BitchX append "[exec] (BitchX) {xterm -title BitchX -fg white -bg black -e BitchX -N}"
214 find_it bitchx append "[exec] (BitchX) {xterm -title BitchX -fg white -bg black -e bitchx -N}"
215 find_it ircii append "[exec] (ircii) {xterm -title ircii -fg white -bg black -e ircii -s}"
216append_menu_end
217
218append_submenu Graphics
219 find_it gimp append "[exec] (gimp) {gimp}"
220 find_it xv append "[exec] (xv) {xv}"
221 find_it gqview append "[exec] (gqview) {gqview}"
222 find_it xpaint append "[exec] (xpaint) {xpaint}"
223 find_it kpaint append "[exec] (kpaint) {kpaint}"
224 find_it kiconedit append "[exec] (kiconedit) {kiconedit}"
225 find_it xscreensaver-demo append "[exec] (xscreensaver-demo) {xscreensaver-demo}"
226append_menu_end
227
228append_submenu Music
229 find_it xmms append "[exec] (xmms) {xmms}"
230 find_it gqmpeg append "[exec] (gqmpeg) {gqmpeg}"
231 find_it xmixer append "[exec] (xmixer) {xmixer}"
232 find_it gmix append "[exec] (gmix) {gmix}"
233 find_it kmix append "[exec] (kmix) {kmix}"
234 find_it grecord append "[exec] (grecord) {grecord}"
235 find_it kmidi append "[exec] (kmidi) {kmidi}"
236 find_it xplaycd append "[exec] (xplaycd) {xplaycd}"
237 find_it soundtracker append "[exec] (soundtracker) {soundtracker}"
238 find_it cplay append "[exec] (cplay) {xterm -title cplay -fg white -bg black -e /usr/local/bin/cplay}"
239 find_it grip append "[exec] (grip) {grip}"
240append_menu_end
241
242append_submenu Terminals
243 append "[exec] (xterm) {xterm -fg white -bg black}"
244 find_it gnome-terminal append "[exec] (gnome-terminal) {gnome-terminal}"
245 find_it Eterm append "[exec] (Eterm) {Eterm}"
246 find_it konsole append "[exec] (konsole) {konsole}"
247 find_it aterm append "[exec] (aterm) {aterm}"
248 find_it rxvt append "[exec] (rxvt) {rxvt}"
249append_menu_end
250
251append_submenu Misc
252 find_it acroread append "[exec] (acroread) {acroread}"
253 find_it gcalc append "[exec] (gcalc) {gcalc}"
254 find_it kcalc append "[exec] (kcalc) {kcalc}"
255 find_it kpackage append "[exec] (kpackage) {kpackage}"
256 find_it xgdb append "[exec] (xgdb) {xgdb}"
257 find_it ddd append "[exec] (ddd) {ddd}"
258 find_it xterm append "[exec] (tail access_log) {xterm -fg white -bg black -title access_log -e tail -f /var/log/access_log}"
259append_menu_end
260
261
262append_submenu X-utils
263 find_it xpenguins append "[exec] (xpenguins) {xpenguins}"
264 find_it xcalc append "[exec] (xcalc) {xcalc}"
265 find_it xfontsel append "[exec] (xfontsel) {xfontsel}"
266 find_it xman append "[exec] (xman) {xman}"
267 find_it xload append "[exec] (xload) {xload}"
268 find_it xfig append "[exec] (xfig) {xfig}"
269 find_it xbiff append "[exec] (xbiff) {xbiff}"
270 find_it editres append "[exec] (editres) {editres}"
271 find_it viewres append "[exec] (viewres) {viewres}"
272 find_it xsnow append "[exec] (xsnow) {xsnow}"
273 find_it xclock append "[exec] (xclock) {xclock}"
274append_menu_end
275
276# gnome menu
277if [ -d $PKGDATADIR/gnome/apps ] && [ $GNOMEMENU ]; then
278 append_submenu Gnome-menus
279 for a in `ls $PKGDATADIR/gnome/apps`; do
280 if [ -d $PKGDATADIR/gnome/apps/"$a" ] ; then
281 append_submenu "$a"
282 menu_entry_dir "$PKGDATADIR/gnome/apps/"$a""
283 menu_entry_dircheck "/etc/X11/applnk/"$a""
284 append_menu_end
285 fi
286 done
287 append_menu_end
288fi
289
290# kde submenu
291if [ -d $PKGDATADIR/applnk/ ] && [ $KDEMENU ]; then
292 append_submenu KDE-menus
293 for a in `ls $PKGDATADIR/applnk/`; do
294 if [ -d $PKGDATADIR/applnk/"$a" ]; then
295 append_submenu "$a"
296 for x in `ls $PKGDATADIR/applnk/"$a"`; do
297 if [ -d $PKGDATADIR/applnk/"$a"/"$x" ]; then
298 append_submenu "$x"
299 menu_entry_dir $PKGDATADIR/applnk/"$a"/"$x"
300 append_menu_end
301 fi
302 done
303 menu_entry_dir $PKGDATADIR/applnk/"$a"
304 append_menu_end
305 fi
306 done
307 menu_entry_dir $PKGDATADIR/applnk/
308 append_menu_end
309fi
310
311
312append_submenu FB-Settings
313 append "[workspaces] (Workspace List)"
314
315 append_menu "[submenu] (Styles) {Choose a style...}"
316 append "[stylesdir] ($PKGDATADIR/fluxbox/styles)"
317 append "[stylesdir] (~/.fluxbox/styles)"
318 append_menu_end
319
320 append "[config] (Configuration)"
321 append "[reconfig] (Reload config)"
322
323 find_it fluxconf append "[exec] (Fluxconf) {fluxconf}"
324
325append_menu_end
326
327 append "[restart] (Restart)"
328 append "[exit] (Exit)"
329
330append_menu_end
331
332
333