Dan Espen <dan1es...@gmail.com> writes: > hw <h...@adminart.net> writes: > >> Hi, >> >> how can I conditionally add menu entries? For example: >> >> >> [...] >> Read fvwm-functions-starters-common.fvwm >> Read fvwm-functions-starters-games.fvwm quiet >> Read fvwm-functions-starters-local.fvwm quiet >> [...] >> >> >> DestroyMenu Main >> AddToMenu Main >> + "Main" Title >> + "Common" PopUp Common >> + "Games" PopUp Games >> + "Local" PopUp Local >> >> >> I want the "Common" and "Games" entries in the menu only when the files >> defining them (like fvwm-functions-starters-games.fvwm) can be read. >> >> I thought I could use something like >> >> DestroyMenu Main >> AddToMenu Main >> + Test (f fvwm-functions-starters-games.fvwm) AddToMenu Main "Games" PopUp >> Games >> >> >> and that doesn't work in that the menu entry doesn't show up regardless >> of the existance of the file. There doesn't seem to be a way to test >> whether something is defined or not; if there was, I could test if a >> menu has been defined and only then add it to another menu. > > Try PipeRead. Use shell, Perl, Python, your choice.
How would that work? I'm trying to make a kinda dynamic configuration, meaning that there is supposed to be a basic configuration accompanied by optional configurations. An optional configuration needs to make an entry for its sub-menu into the root menu if the optional configuration is available. If I was to write some program to create the root menu, I would always need to modify the program when new optional configurations are to be added so it could recognize them. That is something I would prefer to avoid. Hm, having that said, I can make it so that the optional configurations add themselves to the root menu. All they need is a line like AddToMenu Main "Games" PopUp Games Unfortunately, that raises the question how I can make it so that the entries in the root menu appear in a desired order and with the title at the top rather than somewhere in between the entries ... Is there a way to sort menu entries once no more entries are being added? I'm probably not the first one to try this. It can't be this difficult, can it?