home
hook-snooper
kgenmenu4sawfish
  · synopsis
  · usage
  · description
  · download
  · bugs
  · examples
move-viewport
pager
turbo-X11
window-snooper

ideas
miscellaneous
sexyfish


EsperantÒC
iPerl
make.pl Opera utilities

kgenmenu4sawfish - access KDE menu from sawfish (even without running desktop)

SYNOPSIS

  $ kgenmenu4sawfish --apps-menu

In your resource file ~/.sawfish/rc you could add something like:

  (load-file "~/.sawfish/kdemenu")

USAGE

kgenmenu4sawfish[ option|directory[:variable]] ...

If no arguments are given, those given the last time (to at least version 0.6) are reused. This allows building up and reusing complex rules.

-a, --apps-menu
This is equivalent to an argument of .:apps-menu.

-c, --charset=string
This is the destination charset as accepted by recode, e.g. latin2.

-d, --delete=regexp
Delete anything matching regexp in any command to be executed by a menu point.

-e, --eval=Perl-code
For every command to be executed by a menu point, eval the argument. This should modify $_, the current command with all transformations already performed, but not yet output.

-o, --old-args, --old-arguments
Only displays the remembered argument list from the last time. Useful for smaller modifications.

-s, --source, --show-source
Annotates each menu-item in the resulting file with a comment saying from which .desktop file it came.

-u, --unique
Eliminate any command already identically called by another menu point.

-v, --version
-?, --help

Other arguments refer to directories relative to share/applnk under each of $KDEHOME, $KDEDIR and all other $KDEDIRS. These (e.g. SuSE's extensive menu which contains applications other than KDE) can be drawn into separate menu variables. If a colon and a variable-name is given, the menu is stored in that variable. Else the directory-name with a leading kde- and a trailing -menu is used.

If the variable is -, that directory is ignored. Unlike for real variables, this may be repeated for several directories.


DESCRIPTION

Though they don't boast about it, KDE can very well cooperate with other window-managers. Of course you have to find matching themes for yourself. And while KDE goes along with viewports it doesn't seem to have a feature to manage them. AMOR works but you have to adjust its height manually. But these glitches are minor, and sawfish is mostly far superior to kwin. You start it by finding the ksmserver-line in the startup script and adding this option:

  ksmserver --windowmanager sawfish

Or you start sawfish without KDE and use this menu to still get full access to KDE-applications. You can even also include the Gnome menu and get the best from both worlds.

This utility goes through the desktop files in $KDEHOME (if set), $KDEDIR and all other $KDEDIRS and extracts all desktop configurations on how to execute programmes.

The menu label language is selected based on your KDE configuration. If that can't be determined, uses $LC_MESSAGES or $LANG where a country variant, if present, is given precedence over a language-only variant.

For Gnome1 sawfish you must recode Unicode/utf8,to single byte. You need to set the destination in --charset. Those commands which are setup to pass the localized title, also get that recoded.

The resulting sawfish menu is stored in variable kde-menu, unless you use the command line option --apps-menu or an argument .:apps-menu. In the former case you must include this in your menus yourself. In the latter case, sawfish's apps-menu variable gets overwritten, placing the KDE-applications on your menu automatically.


DOWNLOAD

kgenmenu4sawfish (11kB)


BUGS

When upgrading from a pre 0.6 version, display your remembered options with -o and pass them in explicitly the first time.

There are no icons, because sawfish cannot handle them in its menus.

KDE has very many applications so this menu will normally be big - 27kb compared to 4kb for sawfish's gnome-menu on SuSE. And that's with --unique, else you're at 37kb. Since sawfish passes menus off to a dedicated process, there is a very noticeable delay (1 - 2 secs on a Pentium 266) even with menu-process already running. Probably the sawfish-menu process should cache menus, but then of course it can't be guaranteed that the list in sawfish isn't physically modified in the meantime.

It's static, but menus don't change so often.

The gnome menu, if you use it, is not taken into account for --unique.

It's written in Perl, because that was quicker to hack than sawfish lisp.

Given all these drawbacks, future versions should link to or somehow access code from Kicker directly and thus popup a Qt-menu.


EXAMPLES

At least SuSE kindly checks for 3D and/or sound before calling quite a few commands. The option -d'CheckHardware(?: +--(?:3D|sound))+' eliminates that.

An argument of SuSE (given that distribution) will put their submenu as top-level into a separate variable kde-SuSE-menu. Whereas with an argument of SuSE:suse-menu the lisp variable name suse-menu wil be assigned to.

An argument of System/ScreenSavers:- will completely ignore the KDE screensaver menu, and its submenus if it had any, in sawfish.

(Last modified 2003-01-21)