aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-09-07 18:57:35 (GMT)
committerfluxgen <fluxgen>2002-09-07 18:57:35 (GMT)
commit9cca24e1393c79c5281e749bcada0e960c16e47a (patch)
tree9651da97c47998bb4ed4b74dfc03732781256db3 /util
parenta2b39c533e9b4fbf629f0ed64e70d0008044a399 (diff)
downloadfluxbox_pavel-9cca24e1393c79c5281e749bcada0e960c16e47a.zip
fluxbox_pavel-9cca24e1393c79c5281e749bcada0e960c16e47a.tar.bz2
moved from data
Diffstat (limited to 'util')
-rwxr-xr-xutil/fluxbox-generate_menu454
1 files changed, 454 insertions, 0 deletions
diff --git a/util/fluxbox-generate_menu b/util/fluxbox-generate_menu
new file mode 100755
index 0000000..5235a89
--- /dev/null
+++ b/util/fluxbox-generate_menu
@@ -0,0 +1,454 @@
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 which $1 > /dev/null 2> /dev/null && shift && $*
61}
62
63append() {
64 echo " $*" >> ${FILENAME}
65}
66
67append_menu() {
68 echo "$*" >> ${FILENAME}
69}
70
71append_submenu() {
72 echo >> ${FILENAME}
73 append_menu "[submenu] ($1)"
74}
75
76append_menu_end() {
77 append_menu "[end]"
78 echo >> ${FILENAME}
79}
80
81menu_entry() {
82 append "[exec] ("`grep -v GenericName $* | grep Name= | cut -d = -f 2`") \
83 {"`grep -v TryExec $* | grep Exec= | cut -d = -f 2`"}"
84}
85
86menu_entry_dircheck() {
87 if [ -d "$*" ]; then
88 menu_entry_dir "$*"
89 fi
90}
91
92menu_entry_dir() {
93 for b in `ls "$*"/*.desktop 2>/dev/null `; do
94 menu_entry "${b}"
95 done
96}
97
98# Get options.
99while getopts ":khagp:o:m:" COMMAND_LINE_ARGUMENT ; do
100 case "${COMMAND_LINE_ARGUMENT}" in
101 k) KDEMENU=yes ;;
102 g) GNOMEMENU=yes ;;
103 o) FILENAME=${OPTARG} ;;
104 p) PKGDATADIR=${OPTARG} ;;
105 m) MENUTITLE=${OPTARG} ;;
106 h) display_usage ; exit 0 ;;
107 a) display_authors ; exit 0 ;;
108 *) display_help ; exit 1 ;;
109 esac
110done
111
112
113# Set Defaults
114
115# menufile name and make a backup
116if [ -z ${FILENAME} ]; then
117 FILENAME=${HOME}/.fluxbox/menu
118fi
119
120if [ ! -z ${FILENAME} ]; then
121 if [ -w ${FILENAME} ]; then
122 cp -f ${FILENAME} ${FILENAME}.bak
123 fi
124fi
125
126#packagedatadir
127if [ -z "${PKGDATADIR}" ]; then
128 PKGDATADIR=/usr/share
129fi
130
131# menutitle
132if [ -z "${MENUTITLE}" ]; then
133 MENUTITLE="Fluxbox"
134fi
135
136# menu defaults (if translation forget to set one of them)
137BROWSERMENU="Browsers"
138EDITORMENU="Editors"
139NETMENU="Net"
140GRAPHICMENU="Graphics"
141MUSICMENU="Music"
142TERMINALMENU="Terminals"
143MISCMENU="Misc"
144XUTILSMENU="X-utils"
145FBSETTINGSMENU="FB-Settings"
146KDEMENUTEXT="KDE-menus"
147GNOMEMENUTEXT="Gnome-menus"
148RESTARTITEM="Restart"
149EXITITEM="Exit"
150CONFIGUREMENU="Configure"
151RELOADITEM="Reload config"
152STYLEMENU="Styles"
153STYLEMENUTITLE="Choose a style..."
154WORKSPACEMENU="Workspace List"
155
156# Check translation
157case ${LC_ALL} in
158 ru_RU) #Russian locales
159 BROWSERMENU="âÒÁÕÚÅÒÙ"
160 EDITORMENU="òÅÄÁËÔÏÒÙ"
161 NETMENU="óÅÔØ"
162 GRAPHICMENU="çÒÁÆÉËÁ"
163 MUSICMENU="ú×ÕË"
164 TERMINALMENU="ôÅÒÍÉÎÁÌÙ"
165 MISCMENU="ðÒÏÞÅÅ"
166 XUTILSMENU="X-ÕÔÉÌÉÔÙ"
167 FBSETTINGSMENU="FB-ÎÁÓÔÒÏÊËÉ"
168 KDEMENUTEXT="KDE-ÍÅÎÀ"
169 GNOMEMENUTEXT="Gnome-ÍÅÎÀ"
170 RESTARTITEM="ðÅÒÅÚÁÐÕÓÔÉÔØ"
171 EXITITEM="÷ÙÊÔÉ"
172 CONFIGUREMENU="îÁÓÔÒÏÊËÁ"
173 RELOADITEM="ðÅÒÅÎÁÓÔÒÏÉÔØ"
174 STYLEMENU="óÔÉÌÉ"
175 STYLEMENUTITLE="÷ÙÂÅÒÉÔÅ ÓÔÉÌØ"
176 WORKSPACEMENU="òÁÂÏÞÉÅ ÐÒÏÓÔÒÁÎÓÔ×Á"
177 ;;
178 sv_SE) #Swedish locales
179 BROWSERMENU="Browsers"
180 EDITORMENU="Editorer"
181 NETMENU="Net"
182 GRAPHICMENU="Grafik"
183 MUSICMENU="Musik"
184 TERMINALMENU="Terminaler"
185 MISCMENU="Blandat"
186 XUTILSMENU="X-program"
187 FBSETTINGSMENU="FB-inställningar"
188 KDEMENUTEXT="KDE-menyer"
189 GNOMEMENUTEXT="Gnome-menyer"
190 RESTARTITEM="Starta om"
191 EXITITEM="Exit"
192 CONFIGUREMENU="Konfiguration"
193 RELOADITEM="Ladda om konfig"
194 STYLEMENU="Stiler"
195 STYLEMENUTITLE="Välj en stil"
196 WORKSPACEMENU="Arbetsytor"
197 ;;
198 nl_NL) #Nederlandse locales
199 BROWSERMENU="Browsers"
200 EDITORMENU="Editors"
201 NETMENU="Net"
202 GRAPHICMENU="Grafisch"
203 MUSICMENU="Muziek"
204 TERMINALMENU="Terminals"
205 MISCMENU="Onregelmatig"
206 XUTILSMENU="X-utils"
207 FBSETTINGSMENU="FB-Instellingen"
208 KDEMENUTEXT="KDE-menu"
209 GNOMEMENUTEXT="Gnome-menu"
210 RESTARTITEM="Restart"
211 EXITITEM="Einde"
212 CONFIGUREMENU="Instellingen"
213 RELOADITEM="Vernieuwen"
214 STYLEMENU="Stylen"
215 STYLEMENUTITLE="Kies een styl..."
216 WORKSPACEMENU="Werkveld Lijst"
217 ;;
218 fi_FI) #Finnish locales
219 BROWSERMENU="Selaimet"
220 EDITORMENU="Editorit"
221 NETMENU="Verkko"
222 GRAPHICMENU="Grafiikka"
223 MUSICMENU="Musikki"
224 TERMINALMENU="Terminaalit"
225 MISCMENU="Sekalaista"
226 XUTILSMENU="X-Ohjelmat"
227 FBSETTINGSMENU="FB:n Asetukset"
228 KDEMENUTEXT="KDE:n valikot"
229 GNOMEMENUTEXT="Gnomen valikot"
230 RESTARTITEM="Käynnistä uudelleen"
231 EXITITEM="Lopeta"
232 CONFIGUREMENU="Konfigurointi"
233 RELOADITEM="Päivitä"
234 STYLEMENU="Tyylit"
235 STYLEMENUTITLE="Valitse tyyli"
236 WORKSPACEMENU="Työaluet"
237 ;;
238 ja_JP) #Japanese locales
239 BROWSERMENU="¥Ö¥é¥¦¥¶"
240 EDITORMENU="¥¨¥Ç¥£¥¿"
241 NETMENU="¥Í¥Ã¥È¥ï¡¼¥¯"
242 GRAPHICMENU="²èÁü"
243 MUSICMENU="²»³Ú"
244 TERMINALMENU="¥¿¡¼¥ß¥Ê¥ë"
245 MISCMENU="¤¤¤í¤¤¤í"
246 XUTILSMENU="X¥æ¡¼¥Æ¥£¥ê¥Æ¥£"
247 FBSETTINGSMENU="FluxboxÀßÄê"
248 KDEMENUTEXT="KDE¥á¥Ë¥å¡¼"
249 GNOMEMENUTEXT="Gnome¥á¥Ë¥å¡¼"
250 RESTARTITEM="ºÆµ¯Æ°"
251 EXITITEM="½ªÎ»"
252 CONFIGUREMENU="ÀßÄê"
253 RELOADITEM="ºÆÆɤ߹þ¤ß"
254 STYLEMENU="¥¹¥¿¥¤¥ë"
255 STYLEMENUTITLE="¥¹¥¿¥¤¥ëÁªÂò..."
256 WORKSPACEMENU="¥ï¡¼¥¯¥¹¥Ú¡¼¥¹"
257 ;;
258 fr_FR) # french
259 BROWSERMENU="Navigateurs"
260 EDITORMENU="Editeurs"
261 NETMENU="Net"
262 GRAPHICMENU="Graphisme"
263 MUSICMENU="Musique"
264 TERMINALMENU="Terminaux"
265 MISCMENU="Misc"
266 XUTILSMENU="X-utils"
267 FBSETTINGSMENU="FB-Settings"
268 KDEMENUTEXT="menus-KDE"
269 GNOMEMENUTEXT="menus-Gnome"
270 RESTARTITEM="Redémarrer"
271 EXITITEM="Sortir"
272 CONFIGUREMENU="Configurer"
273 RELOADITEM="Recharger config"
274 STYLEMENU="Styles"
275 STYLEMENUTITLE="Choisir un style..."
276 WORKSPACEMENU="Liste des bureaux"
277 ;;
278 *)
279 ;;
280esac
281
282# Start of menu
283
284echo "[begin] (${MENUTITLE})" > ${FILENAME}
285
286find_it xterm append "[exec] (xterm) {xterm -fg white -bg black}"
287find_it nedit append "[exec] (nedit) {nedit}"
288
289
290append_submenu ${BROWSERMENU}
291 find_it netscape append "[exec] (netscape) {netscape}"
292 find_it opera append "[exec] (opera) {env QT_XFT=true opera}"
293 find_it galeon append "[exec] (galeon) {galeon}"
294 find_it mozilla append "[exec] (mozilla) {mozilla}"
295 find_it konqueror append "[exec] (konqueror) {konqueror}"
296 find_it links append "[exec] (links) {xterm -title links -fg white -bg black -e links fluxbox.sf.net}"
297 find_it w3m append "[exec] (w3m) {xterm -title w3m -fg white -bg black -e w3m}"
298 find_it lynx append "[exec] (lynx) {xterm -title lynx -fg white -bg black -e lynx}"
299 find_it dillo append "[exec] (dillo) {dillo}"
300append_menu_end
301
302append_submenu ${EDITORMENU}
303 find_it nedit append "[exec] (nedit) {nedit}"
304 find_it vim append "[exec] (vim) {vim -g}"
305 find_it xemacs append "[exec] (xemacs) {xemacs}"
306 find_it emacs append "[exec] (emacs) {emacs}"
307 find_it gedit append "[exec] (gedit) {gedit}"
308 find_it xedit append "[exec] (xedit) {xedit}"
309 find_it kword append "[exec] (kword) {kword}"
310 find_it kwrite append "[exec] (kwrite) {kwrite}"
311 find_it kate append "[exec] (kate) {kate}"
312append_menu_end
313
314append_submenu ${NETMENU}
315 find_it realplay append "[exec] (realplayer) {realplay}"
316 find_it licq append "[exec] (licq) {env QT_XFT=true licq}"
317 find_it gaim append "[exec] (gaim) {gaim}"
318 find_it sylpheed append "[exec] (sylpheed) {sylpheed}"
319 find_it kmail append "[exec] (kmail) {kmail}"
320 find_it gnomemeeting append "[exec] (gnomemeeting) {gnomemeeting}"
321 find_it evolution append "[exec] (evolution) {evolution}"
322 find_it mutt append "[exec] (mutt) {xterm -title mutt -fg white -bg black -e mutt}"
323
324 find_it gftp append "[exec] (gftp) {gftp}"
325 find_it pan append "[exec] (pan) {pan}"
326 find_it xchat append "[exec] (xchat) {xchat}"
327 find_it irssi append "[exec] (irssi) {xterm -title irssi -e irssi}"
328 find_it BitchX append "[exec] (BitchX) {xterm -title BitchX -fg white -bg black -e BitchX -N}"
329 find_it bitchx append "[exec] (BitchX) {xterm -title BitchX -fg white -bg black -e bitchx -N}"
330 find_it ircii append "[exec] (ircii) {xterm -title ircii -fg white -bg black -e ircii -s}"
331append_menu_end
332
333append_submenu ${GRAPHICMENU}
334 find_it gimp append "[exec] (gimp) {gimp}"
335 find_it xv append "[exec] (xv) {xv}"
336 find_it gqview append "[exec] (gqview) {gqview}"
337 find_it xpaint append "[exec] (xpaint) {xpaint}"
338 find_it kpaint append "[exec] (kpaint) {kpaint}"
339 find_it kiconedit append "[exec] (kiconedit) {kiconedit}"
340 find_it xscreensaver-demo append "[exec] (xscreensaver-demo) {xscreensaver-demo}"
341append_menu_end
342
343append_submenu ${MUSICMENU}
344 find_it xmms append "[exec] (xmms) {xmms}"
345 find_it gqmpeg append "[exec] (gqmpeg) {gqmpeg}"
346 find_it xmixer append "[exec] (xmixer) {xmixer}"
347 find_it gmix append "[exec] (gmix) {gmix}"
348 find_it kmix append "[exec] (kmix) {kmix}"
349 find_it grecord append "[exec] (grecord) {grecord}"
350 find_it kmidi append "[exec] (kmidi) {kmidi}"
351 find_it xplaycd append "[exec] (xplaycd) {xplaycd}"
352 find_it soundtracker append "[exec] (soundtracker) {soundtracker}"
353 find_it cplay append "[exec] (cplay) {xterm -title cplay -fg white -bg black -e /usr/local/bin/cplay}"
354 find_it grip append "[exec] (grip) {grip}"
355append_menu_end
356
357append_submenu ${TERMINALMENU}
358 append "[exec] (xterm) {xterm -fg white -bg black}"
359 find_it gnome-terminal append "[exec] (gnome-terminal) {gnome-terminal}"
360 find_it Eterm append "[exec] (Eterm) {Eterm}"
361 find_it konsole append "[exec] (konsole) {konsole}"
362 find_it aterm append "[exec] (aterm) {aterm}"
363 find_it rxvt append "[exec] (rxvt) {rxvt}"
364append_menu_end
365
366append_submenu ${MISCMENU}
367 find_it acroread append "[exec] (acroread) {acroread}"
368 find_it xpdf append "[exec] (xpdf) {xpdf}"
369 find_it xine append "[exec] (xine) {xine}"
370 find_it aviplay append "[exec] (aviplay) {aviplay}"
371 find_it gtv append "[exec] (gtv) {gtv}"
372 find_it xmovie append "[exec] (xmovie) {xmovie}"
373 find_it xcdroast append "[exec] (xcdroast) {xcdroast}"
374 find_it gcalc append "[exec] (gcalc) {gcalc}"
375 find_it kcalc append "[exec] (kcalc) {kcalc}"
376 find_it kpackage append "[exec] (kpackage) {kpackage}"
377 find_it xgdb append "[exec] (xgdb) {xgdb}"
378 find_it ddd append "[exec] (ddd) {ddd}"
379 find_it xterm append "[exec] (tail access_log) {xterm -fg white -bg black -title access_log -e tail -f /var/log/access_log}"
380append_menu_end
381
382
383append_submenu ${XUTILSMENU}
384 find_it xpenguins append "[exec] (xpenguins) {xpenguins}"
385 find_it xcalc append "[exec] (xcalc) {xcalc}"
386 find_it xfontsel append "[exec] (xfontsel) {xfontsel}"
387 find_it xman append "[exec] (xman) {xman}"
388 find_it xload append "[exec] (xload) {xload}"
389 find_it xfig append "[exec] (xfig) {xfig}"
390 find_it xbiff append "[exec] (xbiff) {xbiff}"
391 find_it editres append "[exec] (editres) {editres}"
392 find_it viewres append "[exec] (viewres) {viewres}"
393 find_it xsnow append "[exec] (xsnow) {xsnow}"
394 find_it xclock append "[exec] (xclock) {xclock}"
395append_menu_end
396
397# gnome menu
398if [ -d ${PKGDATADIR}/gnome/apps -a "${GNOMEMENU}" ]; then
399 append_submenu ${GNOMEMENUTEXT}
400 for a in `ls ${PKGDATADIR}/gnome/apps`; do
401 if [ -d ${PKGDATADIR}/gnome/apps/"${a}" ] ; then
402 append_submenu "${a}"
403 menu_entry_dir "${PKGDATADIR}/gnome/apps/"${a}""
404 menu_entry_dircheck "/etc/X11/applnk/"${a}""
405 append_menu_end
406 fi
407 done
408 append_menu_end
409fi
410
411# kde submenu
412if [ -d ${PKGDATADIR}/applnk/ -a "${KDEMENU}" ]; then
413 append_submenu ${KDEMENUTEXT}
414 for a in `ls ${PKGDATADIR}/applnk/`; do
415 if [ -d ${PKGDATADIR}/applnk/"${a}" ]; then
416 append_submenu "${a}"
417 for x in `ls ${PKGDATADIR}/applnk/"${a}"`; do
418 if [ -d ${PKGDATADIR}/applnk/"${a}"/"${x}" ]; then
419 append_submenu "${x}"
420 menu_entry_dir ${PKGDATADIR}/applnk/"${a}"/"${x}"
421 append_menu_end
422 fi
423 done
424 menu_entry_dir ${PKGDATADIR}/applnk/"${a}"
425 append_menu_end
426 fi
427 done
428 menu_entry_dir ${PKGDATADIR}/applnk/
429 append_menu_end
430fi
431
432
433append_submenu ${FBSETTINGSMENU}
434 append "[workspaces] (${WORKSPACEMENU})"
435
436 append_menu "[submenu] (${STYLEMENU}) {${STYLEMENUTITLE}}"
437 append "[stylesdir] (${PKGDATADIR}/fluxbox/styles)"
438 append "[stylesdir] (~/.fluxbox/styles)"
439 append_menu_end
440
441 append "[config] (${CONFIGUREMENU})"
442 append "[reconfig] (${RELOADITEM})"
443
444 find_it fluxconf append "[exec] (Fluxconf) {fluxconf}"
445
446append_menu_end
447
448 append "[restart] (${RESTARTITEM})"
449 append "[exit] (${EXITITEM})"
450
451append_menu_end
452
453
454