mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-21 05:18:06 +01:00
wmgenmenu: A Window Maker menu generator
The inspiration comes from Geir T. Kristiansen's 'genmenu' shell script (http://gtk.no/genmenu) which I have been hapilly using for the last 9 years or so. That script generates the Window Maker menu by asking a few questions and checks whether the applications in a predefined list exist in the user's $PATH, so that the menu contains only the applications which are guaranteed to exist and which the user cares about. However I always thought it was a bit slow to finish, even when having a file containing the answers to the questions to be piped in. And as Kristiansen states in his webpage, his script does not support internationalization: "If you want internationalization I really suggest you rewrite genmenu from scratch anyway in a more sensible language and remove other limitations while you are at it." so I decided to rewrite in C and make it support internationalization (only English and German so far). While I am not sure yet if I removed "other limitations while you are at it" I definitely made it finish faster. This C program does not make you questions though. But in the same spirit as the author of 'genmenu', who says: "Genmenu is a hack, deal with it, it just happens to serve my needs." I present you 'wmgenmenu', which you can use like this: wmgenmenu > /home/mafra/GNUstep/Defaults/WMRootMenu and the menu is automatically generated from the list of predefined apps which are contained in the C sources (wmgenmenu.h). And when you generate the WMRootMenu as above, wmaker will automatically load the new menu for you (due to the 'inotify' mechanism in wmaker-crm). As for 'wmgenmenu' being faster than 'genmenu': [mafra@Pilar:~]$ time ./genmenu.sh < answers.txt &> /dev/null real 0m3.626s user 0m0.968s sys 0m1.830s [mafra@Pilar:~]$ time wmgenmenu &> /dev/null real 0m0.020s user 0m0.006s sys 0m0.013s
This commit is contained in:
15
configure.ac
15
configure.ac
@@ -283,6 +283,7 @@ else
|
||||
INTLIBS=""
|
||||
MOFILES=""
|
||||
WPMOFILES=""
|
||||
UTILMOFILES=""
|
||||
PO=""
|
||||
fi
|
||||
|
||||
@@ -295,6 +296,7 @@ dnl -------------------------
|
||||
supported_locales="be bg bs ca cs da de el es et fi fr gl hr hu hy it ja ko ms nl no pl pt ro ru sk sv tr zh_CN zh_TW"
|
||||
supported_wprefs_locales="bg ca cs de es et fi fr hr hu it ja ko pt ru sk zh_CN zh_TW"
|
||||
supported_wings_locales="bg ca cs de fr sk"
|
||||
supported_util_locales="de"
|
||||
|
||||
for lang in $LINGUAS; do
|
||||
ok=0
|
||||
@@ -320,6 +322,16 @@ for lang in $LINGUAS; do
|
||||
WPMOFILES="$WPMOFILES $lang.mo"
|
||||
fi
|
||||
ok=0
|
||||
for l in $supported_util_locales; do
|
||||
if test "$l" = "$lang"; then
|
||||
ok=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test "$ok" = 1; then
|
||||
UTILMOFILES="$UTILMOFILES $lang.mo"
|
||||
fi
|
||||
ok=0
|
||||
for l in $supported_wings_locales; do
|
||||
if test "$l" = "$lang"; then
|
||||
ok=1
|
||||
@@ -365,6 +377,7 @@ AC_SUBST(INTLIBS)
|
||||
AC_SUBST(NLSDIR)
|
||||
AC_SUBST(MOFILES)
|
||||
AC_SUBST(WPMOFILES)
|
||||
AC_SUBST(UTILMOFILES)
|
||||
AC_SUBST(WINGSMOFILES)
|
||||
AC_SUBST(supported_locales)
|
||||
|
||||
@@ -898,7 +911,7 @@ dnl AC_CHECK_PROG(TEXI2HTML, texi2html, texi2html, ,$PATH)
|
||||
|
||||
dnl AC_SUBST(DOCTYPES)
|
||||
|
||||
AC_OUTPUT(Makefile po/Makefile util/Makefile test/Makefile \
|
||||
AC_OUTPUT(Makefile po/Makefile util/Makefile util/po/Makefile test/Makefile \
|
||||
WINGs/Makefile WINGs/WINGs/Makefile WINGs/Documentation/Makefile \
|
||||
WINGs/Examples/Makefile WINGs/Resources/Makefile WINGs/Tests/Makefile \
|
||||
WINGs/Extras/Makefile WINGs/po/Makefile \
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
SUBDIRS = po
|
||||
|
||||
AUTOMAKE_OPTIONS = no-dependencies
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
|
||||
bin_PROGRAMS = wxcopy wxpaste wdwrite wdread getstyle setstyle convertfonts \
|
||||
seticons geticonset wmsetbg wmsetup wmagnify
|
||||
seticons geticonset wmsetbg wmsetup wmagnify wmgenmenu
|
||||
|
||||
bin_SCRIPTS = wmaker.inst wm-oldmenu2new wkdemenu.pl
|
||||
|
||||
EXTRA_DIST = wmaker.inst.in bughint wm-oldmenu2new directjpeg.c wkdemenu.pl
|
||||
|
||||
AM_CPPFLAGS = -DLOCALEDIR=\"$(NLSDIR)\"
|
||||
|
||||
INCLUDES = $(DFLAGS) -I$(top_srcdir)/WINGs -I$(top_srcdir)/wrlib \
|
||||
@HEADER_SEARCH_PATH@ \
|
||||
-DETCDIR=\"sysconfdir\" -DDATADIR=\"pkgdatadir\"
|
||||
@@ -60,6 +63,10 @@ wmsetbg_LDADD = \
|
||||
$(top_builddir)/wrlib/libwraster.la \
|
||||
@XLFLAGS@ @XLIBS@ @XFTLIBS@ @INTLIBS@ @DLLIBS@
|
||||
|
||||
wmgenmenu_LDADD = \
|
||||
$(top_builddir)/WINGs/libWUtil.la \
|
||||
@INTLIBS@
|
||||
|
||||
CLEANFILES = wmaker.inst
|
||||
|
||||
wmaker.inst: $(srcdir)/wmaker.inst.in ./Makefile
|
||||
|
||||
41
util/po/Makefile.am
Normal file
41
util/po/Makefile.am
Normal file
@@ -0,0 +1,41 @@
|
||||
CATALOGS = @UTILMOFILES@
|
||||
|
||||
nlsdir = $(NLSDIR)
|
||||
|
||||
CLEANFILES = wmgenmenu.pot $(CATALOGS)
|
||||
|
||||
EXTRA_DIST = de.po
|
||||
|
||||
POTFILES = \
|
||||
$(top_builddir)/util/wmgenmenu.c
|
||||
|
||||
SUFFIXES = .po .mo
|
||||
|
||||
.po.mo:
|
||||
msgfmt -c -o $@ $<
|
||||
|
||||
|
||||
all-local: $(CATALOGS)
|
||||
|
||||
wmgenmenu.pot: $(POTFILES)
|
||||
xgettext --default-domain=wmgenmenu \
|
||||
--add-comments --keyword=_ --keyword=N_ $(POTFILES)
|
||||
if cmp -s wmgenmenu.po wmgenmenu.pot; then \
|
||||
rm -f wmgenmenu.po; \
|
||||
else \
|
||||
mv -f wmgenmenu.po wmgenmenu.pot; \
|
||||
fi
|
||||
|
||||
|
||||
install-data-local: $(CATALOGS)
|
||||
$(mkinstalldirs) $(DESTDIR)$(nlsdir)
|
||||
chmod 755 $(DESTDIR)$(nlsdir)
|
||||
for n in $(CATALOGS) __DuMmY ; do \
|
||||
if test "$$n" -a "$$n" != "__DuMmY" ; then \
|
||||
l=`basename $$n .mo`; \
|
||||
$(mkinstalldirs) $(DESTDIR)$(nlsdir)/$$l/LC_MESSAGES; \
|
||||
chmod 755 $(DESTDIR)$(nlsdir)/$$l; \
|
||||
chmod 755 $(DESTDIR)$(nlsdir)/$$l/LC_MESSAGES; \
|
||||
$(INSTALL_DATA) -m 644 $$n $(DESTDIR)$(nlsdir)/$$l/LC_MESSAGES/wmgenmenu.mo; \
|
||||
fi; \
|
||||
done
|
||||
256
util/po/de.po
Normal file
256
util/po/de.po
Normal file
@@ -0,0 +1,256 @@
|
||||
# wmgenmenu German translation
|
||||
# Copyright (C) 2010 Carlos R. Mafra
|
||||
# This file is distributed under the same license as the Window Maker package.
|
||||
# Carlos R. Mafra <crmafra@gmail.com>, 2010.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: wmgenmenu\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2010-01-28 11:36+0100\n"
|
||||
"PO-Revision-Date: 2010-01-27 12:57+0100\n"
|
||||
"Last-Translator: Carlos R. Mafra <crmafra@gmail.com>\n"
|
||||
"Language-Team: German \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: ../../util/wmgenmenu.c:52
|
||||
#, c-format
|
||||
msgid "Applications"
|
||||
msgstr "Anwendungen"
|
||||
|
||||
#: ../../util/wmgenmenu.c:57
|
||||
#, c-format
|
||||
msgid "Terminals"
|
||||
msgstr "Terminals"
|
||||
|
||||
#: ../../util/wmgenmenu.c:62
|
||||
#, c-format
|
||||
msgid "Internet"
|
||||
msgstr "Internet"
|
||||
|
||||
#: ../../util/wmgenmenu.c:67
|
||||
#, c-format
|
||||
msgid "Email"
|
||||
msgstr "Mitteilung"
|
||||
|
||||
#: ../../util/wmgenmenu.c:72
|
||||
#, c-format
|
||||
msgid "Mathematics"
|
||||
msgstr "Mathematiks"
|
||||
|
||||
#: ../../util/wmgenmenu.c:77
|
||||
#, c-format
|
||||
msgid "File Managers"
|
||||
msgstr "Dateimanagers"
|
||||
|
||||
#: ../../util/wmgenmenu.c:82
|
||||
#, c-format
|
||||
msgid "Graphics"
|
||||
msgstr "Abbildungen"
|
||||
|
||||
#: ../../util/wmgenmenu.c:87
|
||||
#, c-format
|
||||
msgid "Multimedia"
|
||||
msgstr "Multimedia"
|
||||
|
||||
#: ../../util/wmgenmenu.c:92
|
||||
#, c-format
|
||||
msgid "Editors"
|
||||
msgstr "Text-Editoren"
|
||||
|
||||
#: ../../util/wmgenmenu.c:97
|
||||
#, c-format
|
||||
msgid "Development"
|
||||
msgstr "Entwicklung"
|
||||
|
||||
#: ../../util/wmgenmenu.c:102
|
||||
#, c-format
|
||||
msgid "Window Maker"
|
||||
msgstr "Window Maker"
|
||||
|
||||
#: ../../util/wmgenmenu.c:107
|
||||
#, c-format
|
||||
msgid "Office"
|
||||
msgstr "Büro"
|
||||
|
||||
#: ../../util/wmgenmenu.c:112
|
||||
#, c-format
|
||||
msgid "Astronomy"
|
||||
msgstr "Astronomie"
|
||||
|
||||
#: ../../util/wmgenmenu.c:117
|
||||
#, c-format
|
||||
msgid "Sound"
|
||||
msgstr "Klang"
|
||||
|
||||
#: ../../util/wmgenmenu.c:122
|
||||
#, c-format
|
||||
msgid "Comics"
|
||||
msgstr "Comics"
|
||||
|
||||
#: ../../util/wmgenmenu.c:127
|
||||
#, c-format
|
||||
msgid "Viewers"
|
||||
msgstr ""
|
||||
|
||||
#: ../../util/wmgenmenu.c:132
|
||||
#, c-format
|
||||
msgid "Utilities"
|
||||
msgstr "Betriebstoffe"
|
||||
|
||||
#: ../../util/wmgenmenu.c:137
|
||||
#, c-format
|
||||
msgid "System"
|
||||
msgstr ""
|
||||
|
||||
#: ../../util/wmgenmenu.c:142
|
||||
#, c-format
|
||||
msgid "Video"
|
||||
msgstr "Video"
|
||||
|
||||
#: ../../util/wmgenmenu.c:147
|
||||
#, c-format
|
||||
msgid "Chat and Talk"
|
||||
msgstr "Chat und Besprechung"
|
||||
|
||||
#: ../../util/wmgenmenu.c:152
|
||||
#, c-format
|
||||
msgid "P2P-Network"
|
||||
msgstr "P2P-Netzwerk"
|
||||
|
||||
#: ../../util/wmgenmenu.c:157
|
||||
#, c-format
|
||||
msgid "Games"
|
||||
msgstr "Bildschirmspiele"
|
||||
|
||||
#: ../../util/wmgenmenu.c:162
|
||||
#, c-format
|
||||
msgid "OpenSUSE"
|
||||
msgstr ""
|
||||
|
||||
#: ../../util/wmgenmenu.c:167
|
||||
#, c-format
|
||||
msgid "Mandriva"
|
||||
msgstr ""
|
||||
|
||||
#: ../../util/wmgenmenu.c:181
|
||||
#, c-format
|
||||
msgid "Info Panel"
|
||||
msgstr "Info-Panel"
|
||||
|
||||
#: ../../util/wmgenmenu.c:185
|
||||
#, c-format
|
||||
msgid "Restart"
|
||||
msgstr "Neustart"
|
||||
|
||||
#: ../../util/wmgenmenu.c:192
|
||||
#, c-format
|
||||
msgid "Exit..."
|
||||
msgstr "Beenden..."
|
||||
|
||||
#: ../../util/wmgenmenu.c:229
|
||||
#, c-format
|
||||
msgid "Config wmaker..."
|
||||
msgstr "Einstellungen..."
|
||||
|
||||
#: ../../util/wmgenmenu.c:237
|
||||
#, c-format
|
||||
msgid "Workspaces"
|
||||
msgstr "Arbeitsflächen"
|
||||
|
||||
#: ../../util/wmgenmenu.c:241
|
||||
#, c-format
|
||||
msgid "Workspace"
|
||||
msgstr "Arbeitsfläche"
|
||||
|
||||
#: ../../util/wmgenmenu.c:245
|
||||
#, c-format
|
||||
msgid "Hide others"
|
||||
msgstr "Ändere verstecken"
|
||||
|
||||
#: ../../util/wmgenmenu.c:249
|
||||
#, c-format
|
||||
msgid "Show all"
|
||||
msgstr "Alle anzeigen"
|
||||
|
||||
#: ../../util/wmgenmenu.c:253
|
||||
#, c-format
|
||||
msgid "Arrange Icons"
|
||||
msgstr "Icons anordnen"
|
||||
|
||||
#: ../../util/wmgenmenu.c:257
|
||||
#, c-format
|
||||
msgid "Refresh"
|
||||
msgstr "Neuzeichen"
|
||||
|
||||
#: ../../util/wmgenmenu.c:261
|
||||
#, c-format
|
||||
msgid "Save Session"
|
||||
msgstr "Arbeitsplatz sichern"
|
||||
|
||||
#: ../../util/wmgenmenu.c:265
|
||||
#, c-format
|
||||
msgid "Clear Session"
|
||||
msgstr "X Sitzung leeren"
|
||||
|
||||
#: ../../util/wmgenmenu.c:278
|
||||
#, c-format
|
||||
msgid "Lock Screen"
|
||||
msgstr "Bildschirm speeren"
|
||||
|
||||
#: ../../util/wmgenmenu.c:290
|
||||
#, c-format
|
||||
msgid "Other Window Managers"
|
||||
msgstr "Ändere Fenstermanagers"
|
||||
|
||||
#: ../../util/wmgenmenu.c:298
|
||||
#, c-format
|
||||
msgid "Start %s"
|
||||
msgstr "%s starten"
|
||||
|
||||
#: ../../util/wmgenmenu.c:311
|
||||
#, c-format
|
||||
msgid "Workspace Appearance"
|
||||
msgstr "Erscheinungsbild"
|
||||
|
||||
#: ../../util/wmgenmenu.c:315
|
||||
#, c-format
|
||||
msgid "Themes"
|
||||
msgstr "Themen"
|
||||
|
||||
#: ../../util/wmgenmenu.c:319
|
||||
#, c-format
|
||||
msgid "Styles"
|
||||
msgstr "Stile"
|
||||
|
||||
#: ../../util/wmgenmenu.c:323
|
||||
#, c-format
|
||||
msgid "Icons"
|
||||
msgstr "Iconsätze"
|
||||
|
||||
#: ../../util/wmgenmenu.c:327
|
||||
#, c-format
|
||||
msgid "Background"
|
||||
msgstr "Hintergrund"
|
||||
|
||||
#: ../../util/wmgenmenu.c:331
|
||||
#, c-format
|
||||
msgid "Save Theme"
|
||||
msgstr "Thema speichern"
|
||||
|
||||
#: ../../util/wmgenmenu.c:335
|
||||
#, c-format
|
||||
msgid "Save Icons"
|
||||
msgstr "Iconsatz speichern"
|
||||
|
||||
#: ../../util/wmgenmenu.c:348
|
||||
#, c-format
|
||||
msgid "Run..."
|
||||
msgstr "Ausführen..."
|
||||
|
||||
#: ../../util/wmgenmenu.c:350
|
||||
#, c-format
|
||||
msgid "Run, Type command:"
|
||||
msgstr "Ausführen, Befehl zum Ausführen eingeben:"
|
||||
369
util/wmgenmenu.c
Normal file
369
util/wmgenmenu.c
Normal file
@@ -0,0 +1,369 @@
|
||||
/* Copyright (C) 2010 Carlos R. Mafra */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <locale.h>
|
||||
#include <libintl.h>
|
||||
#define _(text) gettext(text)
|
||||
|
||||
#include <WINGs/WUtil.h>
|
||||
|
||||
#define MAX_NR_APPS 50 /* Maximum number of entries in each apps list */
|
||||
#define MAX_WMS 10 /* Maximum number of other window managers to check */
|
||||
#include "wmgenmenu.h"
|
||||
|
||||
static void find_and_write(char **list);
|
||||
static inline void workspaces(void);
|
||||
static inline void lock_screen(void);
|
||||
static inline void wmaker_config(void);
|
||||
static inline void run_command(void);
|
||||
static void other_window_managers(char **other_wm);
|
||||
static inline void wm_visual(void);
|
||||
static inline void write_first_line(int count);
|
||||
|
||||
char *path;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int fd;
|
||||
char *locale;
|
||||
extern char *path;
|
||||
|
||||
path = getenv("PATH");
|
||||
locale = getenv("LANG");
|
||||
setlocale(LC_ALL, "");
|
||||
|
||||
if (getenv("NLSPATH"))
|
||||
bindtextdomain("wmgenmenu", getenv("NLSPATH"));
|
||||
else
|
||||
bindtextdomain("wmgenmenu", LOCALEDIR);
|
||||
|
||||
bind_textdomain_codeset("wmgenmenu", "UTF-8");
|
||||
textdomain("wmgenmenu");
|
||||
|
||||
printf("\(\"Window Maker\",\n");
|
||||
|
||||
printf(" \(\"");
|
||||
printf(_("Applications"));
|
||||
printf("\",\n");
|
||||
|
||||
/* This "first" printf is different from the others! */
|
||||
printf(" \(\"");
|
||||
printf(_("Terminals"));
|
||||
printf("\"");
|
||||
find_and_write(terminals);
|
||||
|
||||
printf("\n ),\n \(\"");
|
||||
printf(_("Internet"));
|
||||
printf("\"");
|
||||
find_and_write(internet);
|
||||
|
||||
printf("\n ),\n \(\"");
|
||||
printf(_("Email"));
|
||||
printf("\"");
|
||||
find_and_write(email);
|
||||
|
||||
printf("\n ),\n \(\"");
|
||||
printf(_("Mathematics"));
|
||||
printf("\"");
|
||||
find_and_write(Mathematiks);
|
||||
|
||||
printf("\n ),\n \(\"");
|
||||
printf(_("File Managers"));
|
||||
printf("\"");
|
||||
find_and_write(file_managers);
|
||||
|
||||
printf("\n ),\n \(\"");
|
||||
printf(_("Graphics"));
|
||||
printf("\"");
|
||||
find_and_write(Graphics);
|
||||
|
||||
printf("\n ),\n \(\"");
|
||||
printf(_("Multimedia"));
|
||||
printf("\"");
|
||||
find_and_write(Multimedia);
|
||||
|
||||
printf("\n ),\n \(\"");
|
||||
printf(_("Editors"));
|
||||
printf("\"");
|
||||
find_and_write(Editors);
|
||||
|
||||
printf("\n ),\n \(\"");
|
||||
printf(_("Development"));
|
||||
printf("\"");
|
||||
find_and_write(development);
|
||||
|
||||
printf("\n ),\n \(\"");
|
||||
printf(_("Window Maker"));
|
||||
printf("\"");
|
||||
find_and_write(WindowMaker);
|
||||
|
||||
printf("\n ),\n \(\"");
|
||||
printf(_("Office"));
|
||||
printf("\"");
|
||||
find_and_write(Office);
|
||||
|
||||
printf("\n ),\n \(\"");
|
||||
printf(_("Astronomy"));
|
||||
printf("\"");
|
||||
find_and_write(Astronomie);
|
||||
|
||||
printf("\n ),\n \(\"");
|
||||
printf(_("Sound"));
|
||||
printf("\"");
|
||||
find_and_write(Sound);
|
||||
|
||||
printf("\n ),\n \(\"");
|
||||
printf(_("Comics"));
|
||||
printf("\"");
|
||||
find_and_write(Comics);
|
||||
|
||||
printf("\n ),\n \(\"");
|
||||
printf(_("Viewers"));
|
||||
printf("\"");
|
||||
find_and_write(Viewers);
|
||||
|
||||
printf("\n ),\n \(\"");
|
||||
printf(_("Utilities"));
|
||||
printf("\"");
|
||||
find_and_write(Utilities);
|
||||
|
||||
printf("\n ),\n \(\"");
|
||||
printf(_("System"));
|
||||
printf("\"");
|
||||
find_and_write(System);
|
||||
|
||||
printf("\n ),\n \(\"");
|
||||
printf(_("Video"));
|
||||
printf("\"");
|
||||
find_and_write(Video);
|
||||
|
||||
printf("\n ),\n \(\"");
|
||||
printf(_("Chat and Talk"));
|
||||
printf("\"");
|
||||
find_and_write(Chat);
|
||||
|
||||
printf("\n ),\n \(\"");
|
||||
printf(_("P2P-Network"));
|
||||
printf("\"");
|
||||
find_and_write(P2P);
|
||||
|
||||
printf("\n ),\n \(\"");
|
||||
printf(_("Games"));
|
||||
printf("\"");
|
||||
find_and_write(Games);
|
||||
|
||||
printf("\n ),\n \(\"");
|
||||
printf(_("OpenSUSE"));
|
||||
printf("\"");
|
||||
find_and_write(OpenSUSE);
|
||||
|
||||
printf("\n ),\n \(\"");
|
||||
printf(_("Mandriva"));
|
||||
printf("\"");
|
||||
find_and_write(Mandriva);
|
||||
|
||||
/* This must be after the last entry */
|
||||
printf("\n )\n");
|
||||
printf(" ),\n");
|
||||
|
||||
run_command();
|
||||
wm_visual();
|
||||
workspaces();
|
||||
wmaker_config();
|
||||
|
||||
printf("(\"");
|
||||
printf(_("Info Panel"));
|
||||
printf("\", INFO_PANEL),\n");
|
||||
|
||||
printf("(\"");
|
||||
printf(_("Restart"));
|
||||
printf("\", RESTART),\n");
|
||||
|
||||
other_window_managers(other_wm);
|
||||
lock_screen();
|
||||
|
||||
printf("(\"");
|
||||
printf(_("Exit..."));
|
||||
printf("\", EXIT)\n");
|
||||
|
||||
/* Final closing parenthesis */
|
||||
printf(")\n");
|
||||
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
static void find_and_write(char **list)
|
||||
{
|
||||
int i, argc;
|
||||
char *location, **argv;
|
||||
extern char *path;
|
||||
|
||||
for (i = 0; i <= MAX_NR_APPS; i++) {
|
||||
if (list[i]) {
|
||||
/* Before checking if app exists, split its options */
|
||||
wtokensplit(list[i], &argv, &argc);
|
||||
location = wfindfile(path, argv[0]);
|
||||
if (location) {
|
||||
/* check whether it is to be executed in a terminal */
|
||||
if (strcmp("!", argv[argc - 1]) < 0)
|
||||
printf(",\n \(\"%s\", EXEC, \"%s\")", argv[0], list[i]);
|
||||
else {
|
||||
char comm[50], *ptr[1];
|
||||
|
||||
strcpy(comm, list[i]);
|
||||
/* ugly hack to delete character ! from list[i] */
|
||||
ptr[0] = strchr(comm,'!');
|
||||
*ptr[0] = ' ';
|
||||
printf(",\n \(\"%s\", EXEC, \"xterm -e %s\")", argv[0], comm);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void wmaker_config(void)
|
||||
{
|
||||
char *location = wfindfile(path, "WPrefs");
|
||||
|
||||
if (location) {
|
||||
printf("(\"");
|
||||
printf(_("Config wmaker..."));
|
||||
printf("\", EXEC, \"WPrefs\"),\n");
|
||||
}
|
||||
}
|
||||
|
||||
static inline void workspaces(void)
|
||||
{
|
||||
printf("(\"");
|
||||
printf(_("Workspaces"));
|
||||
printf("\", WORKSPACE_MENU),\n");
|
||||
|
||||
printf(" (\"");
|
||||
printf(_("Workspace"));
|
||||
printf("\",\n");
|
||||
|
||||
printf(" (\"");
|
||||
printf(_("Hide others"));
|
||||
printf("\", HIDE_OTHERS),\n");
|
||||
|
||||
printf(" (\"");
|
||||
printf(_("Show all"));
|
||||
printf("\", SHOW_ALL),\n");
|
||||
|
||||
printf(" (\"");
|
||||
printf(_("Arrange Icons"));
|
||||
printf("\", ARRANGE_ICONS),\n");
|
||||
|
||||
printf(" (\"");
|
||||
printf(_("Refresh"));
|
||||
printf("\", REFRESH),\n");
|
||||
|
||||
printf(" (\"");
|
||||
printf(_("Save Session"));
|
||||
printf("\", SAVE_SESSION),\n");
|
||||
|
||||
printf(" (\"");
|
||||
printf(_("Clear Session"));
|
||||
printf("\", CLEAR_SESSION)\n");
|
||||
|
||||
printf(" ),\n");
|
||||
}
|
||||
|
||||
static inline void lock_screen(void)
|
||||
{
|
||||
char *location;
|
||||
|
||||
location = wfindfile(path, "xlock");
|
||||
if (location) {
|
||||
printf("(\"");
|
||||
printf(_("Lock Screen"));
|
||||
printf("\", EXEC, \"xlock -allowroot -usefirst -mode matrix\"),\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void other_window_managers(char **other_wm)
|
||||
{
|
||||
int count = 0;
|
||||
char *location;
|
||||
int i;
|
||||
|
||||
printf("(\"");
|
||||
printf(_("Other Window Managers"));
|
||||
printf("\",\n");
|
||||
|
||||
for (i = 0; i <= MAX_WMS; i++) {
|
||||
if (other_wm[i]) {
|
||||
location = wfindfile(path, other_wm[i]);
|
||||
if (location) {
|
||||
write_first_line(count);
|
||||
printf(_("Start %s"), other_wm[i]);
|
||||
printf("\", RESTART, \"%s\")", other_wm[i]);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("\n),\n");
|
||||
}
|
||||
|
||||
static void wm_visual(void)
|
||||
{
|
||||
/* TODO: add more pre-defined dirs to Themes etc */
|
||||
printf("(\"");
|
||||
printf(_("Workspace Appearance"));
|
||||
printf("\",\n");
|
||||
|
||||
printf("(\"");
|
||||
printf(_("Themes"));
|
||||
printf("\", OPEN_MENU, \"-noext $HOME/GNUstep/Library/WindowMaker/Themes WITH setstyle\"),\n");
|
||||
|
||||
printf("(\"");
|
||||
printf(_("Styles"));
|
||||
printf("\", OPEN_MENU, \"-noext $HOME/GNUstep/Library/WindowMaker/Styles WITH setstyle\"),\n");
|
||||
|
||||
printf("(\"");
|
||||
printf(_("Icons"));
|
||||
printf("\", OPEN_MENU, \"-noext $HOME/GNUstep/Library/WindowMaker/IconSets WITH seticons\"),\n");
|
||||
|
||||
printf("(\"");
|
||||
printf(_("Background"));
|
||||
printf("\", OPEN_MENU, \"-noext $HOME/GNUstep/Library/WindowMaker/Backgrounds WITH wmsetbg -u -t\"),\n");
|
||||
|
||||
printf("(\"");
|
||||
printf(_("Save Theme"));
|
||||
printf("\", SHEXEC, \"getstyle -t $HOME/GNUstep/Library/WindowMaker/Themes/\\\"%%a(Theme name)\\\"\"),\n");
|
||||
|
||||
printf("(\"");
|
||||
printf(_("Save Icons"));
|
||||
printf("\", SHEXEC, \"geticonset $HOME/GNUstep/Library/WindowMaker/IconSets/\\\"%%a(IconSet name)\\\"\")\n");
|
||||
printf("),\n");
|
||||
|
||||
}
|
||||
|
||||
static inline void run_command(void)
|
||||
{
|
||||
/*
|
||||
* %A below requires Voinov's "Add dialog history" (which
|
||||
* is included in wmaker-crm), otherwise it should be %a
|
||||
*/
|
||||
printf("\(\"");
|
||||
printf(_("Run..."));
|
||||
printf("\", SHEXEC, \"%%A(");
|
||||
printf(_("Run, Type command:"));
|
||||
printf(")\"),\n");
|
||||
}
|
||||
|
||||
static inline void write_first_line(int count)
|
||||
{
|
||||
/* All lines inside a menu must end with a comma, except for
|
||||
* the last one. To cope with this let's check if there is a
|
||||
* previous entry before writing the "start of the line", and
|
||||
* write the trailing comma if there is.
|
||||
*/
|
||||
if (count == 0)
|
||||
printf(" (\"");
|
||||
else {
|
||||
printf(",\n (\"");
|
||||
}
|
||||
}
|
||||
138
util/wmgenmenu.h
Normal file
138
util/wmgenmenu.h
Normal file
@@ -0,0 +1,138 @@
|
||||
/* Copyright (C) 2010 Carlos R. Mafra */
|
||||
|
||||
/*
|
||||
* If the program should run from inside a terminal it has
|
||||
* to finish with a space followed by '!', e.g.
|
||||
* "mutt !"
|
||||
*/
|
||||
|
||||
static char *terminals[MAX_NR_APPS] = {
|
||||
"mrxvt -rv -shade 00 -vb +sb +sm -tr -sl 2000 -trt -itabbg black -hb -tabfg yellow -fn 10x20 -cr yellow",
|
||||
"xterm -bg black -fg white +sb +sm -fn 10x20 -sl 4000 -cr yellow",
|
||||
"konsole"
|
||||
};
|
||||
|
||||
char *file_managers[MAX_NR_APPS] = {
|
||||
"dolphin", "thunar", "rox", "GWorkspace",
|
||||
"xftree", "konqueror", "nautilus --no-desktop", "fsviewer", "xfe"
|
||||
};
|
||||
|
||||
char *Mathematiks[MAX_NR_APPS] = {
|
||||
"xmaxima", "maple" , "scilab" "maxima !", "bc !",
|
||||
"kcalc", "xcalc", "mathematica", "math"
|
||||
};
|
||||
|
||||
char *Astronomie[MAX_NR_APPS] = {
|
||||
"xplns", "stellarium"
|
||||
};
|
||||
|
||||
char *Graphics[MAX_NR_APPS] = {
|
||||
"gimp", "sodipodi", "killustrator", "krayon", "kpovmodeler",
|
||||
"bitmap", "xpaint", "xfig", "kpaint", "blender", "ksnapshot",
|
||||
"gphoto", "dia", "compupic", "gqview", "kview", "pixie",
|
||||
"display", "ee", "xv", "eog", "qiv !"
|
||||
};
|
||||
|
||||
char *Multimedia[MAX_NR_APPS] = {
|
||||
"audacious2", "kaffeine", "audacity", "xmms", "k9copy", "acidrip",
|
||||
"avidemux2_gtk", "gqmpeg", "freeamp", "realplay",
|
||||
"kmid", "kmidi", "gtcd", "grip", "aviplay", "gtv", "gvlc", "sinek",
|
||||
"xine", "aktion", "gcd", "xawtv", "xcdroast", "xplaycd"
|
||||
};
|
||||
|
||||
char *internet[MAX_NR_APPS] = {
|
||||
"chromium", "google-chrome", "firefox",
|
||||
"galeon", "skipstone", "konqueror",
|
||||
"dillo", "epiphany", "opera", "midori", "seamonkey",
|
||||
"kazehakase", "links !", "lynx !"
|
||||
};
|
||||
|
||||
char *email[MAX_NR_APPS] = {
|
||||
"thunderbird", "mutt !", "GNUMail", "evolution",
|
||||
"kleopatra", "sylpheed", "spruce", "kmail", "exmh",
|
||||
"pine !", "elm !"
|
||||
};
|
||||
|
||||
char *Sound[MAX_NR_APPS] = {
|
||||
"soundkonverter", "krecord", "grecord", "alsamixer !", "sndconfig !",
|
||||
"aumix !", "gmix"
|
||||
};
|
||||
|
||||
char *Editors[MAX_NR_APPS] = {
|
||||
"xjed", "jed !", "emacs", "xemacs", "gvim", "vi !", "vim !", "gedit",
|
||||
"kedit", "xedit", "kwrite", "kate", "pico !", "nano !", "joe !"
|
||||
};
|
||||
|
||||
char *Comics[MAX_NR_APPS] = {
|
||||
"omnia_data", "comix", "qcomicbook"
|
||||
};
|
||||
|
||||
char *Viewers[MAX_NR_APPS] = {
|
||||
"evince", "kghostview", "gv", "ggv", "xdvi", "kdvi", "xpdf",
|
||||
"acroread", "gless"
|
||||
};
|
||||
|
||||
char *Utilities[MAX_NR_APPS] = {
|
||||
"gdlinux", "k3b", "gtkfind", "gdict", "gpsdrive", "wfcmgr", "switch",
|
||||
"kaddressbook", "kab", "kfind", "oclock", "rclock", "xclock", "kppp"
|
||||
};
|
||||
|
||||
char *Video[MAX_NR_APPS] = {
|
||||
"kaffeine", "gnomemeeting"
|
||||
};
|
||||
|
||||
char *Chat[MAX_NR_APPS] = {
|
||||
"pidgin", "skype", "gizmo", "kopete", "xchat", "kvirc", "BitchX !",
|
||||
"epic !", "epic4 !", "irssi !", "tinyirc !", "ksirc", "gtalk",
|
||||
"gnome-icu", "licq", "amsn"
|
||||
};
|
||||
|
||||
char *P2P[MAX_NR_APPS] = {
|
||||
"amule", "gftp", "smb4k", "ktorrent", "bittorrent-gui",
|
||||
"!ftp", "!sftp", "pavuk", "gtm","!gnut", "gtk-gnutella", "gnutmeg"
|
||||
};
|
||||
|
||||
char *Games[MAX_NR_APPS] = {
|
||||
"fgfs", "tremulous", "xboard", "gnome-chess", "quake2", "quake3",
|
||||
"q3ut2", "sof", "rune", "tribes2", "unreal", "descent3", "myth2",
|
||||
"rt2", "heretic2", "kohan", "xqf"
|
||||
};
|
||||
|
||||
char *Office[MAX_NR_APPS] = {
|
||||
"oowriter", "oocalc", "ooconfigimport", "oodraw", "ooffice",
|
||||
"ooimpress", "oomath", "ooregcomp", "abiword", "kword",
|
||||
"smath", "swriterkpresenter", "lyx", "klyx", "gnucash", "gnumeric",
|
||||
"kspread", "kchart","gnomecal", "gnomecard", "korganizer"
|
||||
};
|
||||
|
||||
char *development[MAX_NR_APPS] = {
|
||||
"gitk", "gitview", "qgit", "git-gui", "glimmer", "glade", "kdevelop",
|
||||
"designer", "kbabel", "idle", "ghex", "hexedit !", "memprof", "tclsh !",
|
||||
"gdb !", "xxgdb", "xev !"
|
||||
};
|
||||
|
||||
char *System[MAX_NR_APPS] = {
|
||||
"iotop -d 4 --only !", "keybconf", "gtop", "top !", "kpm", "gw", "gnomecc", "gkrellm",
|
||||
"tksysv", "ksysv", "gnome-ppp", "iostat -p -k 5 !"
|
||||
};
|
||||
|
||||
char *OpenSUSE[MAX_NR_APPS] = {
|
||||
"yast2", "yast !", "systemsettings", "umtsmon"
|
||||
};
|
||||
|
||||
char *Mandriva[MAX_NR_APPS] = {
|
||||
"draknetcenter", "rpmdrake", "harddrake", "drakconf",
|
||||
"MandrakeUpdate", "Xdrakres"
|
||||
};
|
||||
|
||||
char *WindowMaker[MAX_NR_APPS] = {
|
||||
"wmnet -d 100000 -Weth0", "wmpower", "wmlaptop2", "wmwifi -s", "wmifinfo",
|
||||
"wmWeather", "wmstickynotes", "wmmixer++ -w", "wmWeather -m -s EDDB",
|
||||
"wmcpuload", "wmcpufreq", "wmclockmon", "wmnd", "wmCalclock -S",
|
||||
"wmtime", "wmdate", "wmmon", "wmsysmon", "wmSMPmon", "wmifs",
|
||||
"wmnd", "wmbutton", "wmxmms", "wmpower", "wmagnify"
|
||||
};
|
||||
|
||||
char *other_wm[MAX_WMS] = {
|
||||
"icewm", "kwin", "twm", "fluxbox", "blackbox", "ion"
|
||||
};
|
||||
Reference in New Issue
Block a user