1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-02-14 12:55:47 +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:
Carlos R. Mafra
2010-01-25 10:55:33 +01:00
parent 6367bf5234
commit 1861880239
6 changed files with 826 additions and 2 deletions

View File

@@ -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 \