[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

fvwm2 and system.fvwmrc and an automatic "Programs" menu



I wrote a new system.fvwmrc for my own system.  The major enhancement
is that it is extensible by the system administrator and user
(similar to /etc/profile and .profile).  The basic system.fvwmrc sets up
a default environment, and calls upon files in /etc/X11/fvwm2 (so that
the sysadmin can change the default environment for all users) and in
~/.fvwm2 (so that the user can add further changes).

The advantage is that the user does not need to copy the system.fvwmrc
to ~/.fvwm2rc.  If he does, and system.fvwmrc is later modified, he has to
modify his ~/.fvwm2rc similarly to take advantage of the changes.  With
my system.fvwmrc this is not necessary.

So, basically, I just added a "Read .fvwm2/post.hook" at the end of 
system.fvwmrc, right?  Well, yes, but with a minor twist: I wanted users 
to be able to add entries to the main menu, without having to rewrite it.  
So I added a "Read .fvwm2/main-menu.hook" in the middle of the main menu
definition.  And a similar "Read .fvwm2/init.hook" for the fvwm 
initialization function (and then the same for the restart function).

I also added corresponding "Read /etc/X11/fvwm2/*" commands, so that the
sysadmin can change stuff.

So far, so good.  I think this would already good enough to replace the
current system.fvwmrc.  Actually, it might be better to just add similar
hooks to the current system.fvwmrc; my system.fvwmrc puts in my own
stuff for colors and stuff, which may not be palatable to everyone.

Then I wrote a script that generates a fvwm menu definitions based on a 
data file (menus.dat), and added a new hook to read the generated file
(/etc/X11/fvwm2/menudefs.hook and .fvwm2/menudefs.hook).  I added a
script that adds entries to menus.dat.

This makes it relatively easy to create some menus automatically.  What
I want it for is to have each suitable Debian do a 

	install-fvwm2entry <args>
	
in the postinst script.  This command will add or modify a line in
menus.dat.  Then 

	build-fvwm2menus
	
will read menus.dat and output the new menu definitions into 
/etc/X11/fvwm2/menudefs.hook, and system.fvwmrc will read them from
there into the main menu.

In the prerm script, the corresponding command would be

	remove-fvwm2entry <args>

This would make it possible to have a "Programs" menu that automatically
reflects the currently installed set of programs.  (We could call it "Start",
if we wanted. :)  Even better, it is not necessary to have just one
menu -- we can break it into "Editors", "Games", "Graphics", "Other apps",
and so on.  (The current design does not allow spaces in menu names, or
submenus, but those are fixable.)

Before I spend your and my time further, what do you all think?  First,
is the system.fvwmrc that is extensible via hooks a good idea (note that
the user may still override it completely by copying it as .fvwm2rc)?
Second, does an automatic "Programs" menu have any support?



Reply to: