Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
Piotr Zieliński
[go: Go Back, main page]

Autogenerating FVWM menus

This page contains a collection of scripts that allow FVWM to generate (some of) its menus automatically, getting revelant information from various common files. Possible uses of dynamically generated menus include: all applications installed in a system, recently used applications, recently visited directories, the list of remote to known to ssh. In all these cases, special care must be taken to display a sensible amount of information; in particular, not to flood the user with tens or hundreds of unorganized items. Alternative implementations of FVWM autogenerated menus are available.

XDG menus in FVWM

Major desktop environments such as Gnome or KDE contain menus to which various applications can add themselves automatically, using the Desktop Menu Specification standard. You can achieve the same effect in FVWM using a small python script fvwm-xdg-menu.py, which translates an XDG menu description into FVWM syntax. An example of its usage can be found in build-xdg-menu.

Recently visited directories

Again, most desktop environments have a menu consisting of recently opened files. This solution works for those who open only a few documents a day. However, if you are a programmer working on several projects, the list of recently opened documents contains a few dozen files, and becomes useless. Moreover, it's not uncommon for files in different directories having the same name, which adds even more confusion (think "Makefile").

My approach is to display the list of recently visited directories, that is, directories in which you edited documents. (Not merely "viewed" directories; there are too many of these. I think the fact that you change a file in a directory makes it somehow more important.) Again, the list of directories can't be merely a list of names because some names repeat and don't give you much information ("CVS"). Showing full paths produces super-wide menus filled with irrelevant information (all entries starting with "/home/yourname"). Showing the last 20 characters of each path is very disorienting; just think of how to sort such a thing.

What I used instead is a tree display that contains only directories of interest. To avoid wasting a menu for intermediate directories, a directory is not given a menu entry if it has exactly one child. For example, if you have three favourite directories "/usr/local/share/emacs/site-lisp/one", "/usr/local/share/emacs/site-lisp/two", and "/usr/local/share/fvwm", the following entries will be displayed "/usr/local/share/", "emacs/site-lisp/", "one/", "two/", and "fvwm", appropriately indented.

The script recentdir-menu.py takes a list of recently opened files from the standard input and output a tree-like FVWM menu of recently visited directories into standard output. A wrapper script build-recentdir-menu uses the list of files recently edited by Emacs ("~/.recentf").