Subject: FVWM: Can popup menus be dynamic without restarting fvwm?

From: "Douglas Straub" <[email-masked]>
Date: Wed, 20 Jan 1999 17:35:06 -0700

Hi, 
    I was looking through the code for the module FvwmTaskBar, and I see that the menu for
the taskbar is created in the .fvwm2rc file, and is activated by the module sending a message
to fvwm.  I was wondering if menus could be made to be dynamic?  For example, suppose I had
a Popup defined in my .fvwm2rc as:

Popup foo {
         "bar" Exec nop
}

Could I have a module "Read" a file that would redefine the foo Popup such that the
entries and the actions change such as:
Popup foo {
         "fum" Exec ls
}
Or must I always restart fvwm2?  Thanks.

---

From: Jim Nicholson <[email-masked]>
Date: Wed, 20 Jan 1999 20:43:55 -0500 (EST)

Your friends are AddToMenu, DestroyMenu, and Read.

But, of course, your best friend is "man fvwm2".

Your best friend wishes you would look him up.

;)

- Jim

Douglas Straub writes:
 > <!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
 > <HTML>
 > <HEAD>
 > 
 > <META content=text/html;charset=iso-8859-1 http-equiv=Content-Type>
 > <META content='"MSHTML 4.72.3110.7"' name=GENERATOR>
 > </HEAD>
 > <BODY bgColor=#ffffff>
 > <DIV><FONT color=#000000 size=2>Hi, </FONT></DIV>
 > <DIV><FONT color=#000000 size=2>&nbsp;&nbsp;&nbsp; I was looking through the 
 > code for the module FvwmTaskBar, and I see that the menu for</FONT></DIV>
 > <DIV><FONT color=#000000 size=2>the taskbar is created in the .fvwm2rc file, and 
 > is activated by the module sending a message</FONT></DIV>
 > <DIV><FONT color=#000000 size=2></FONT><FONT size=2>to fvwm.&nbsp; I was 
 > wondering if menus could be made to be dynamic?&nbsp; For example, suppose I 
 > had</FONT></DIV>
 > <DIV><FONT size=2>a Popup defined in my .fvwm2rc </FONT><FONT 
 > size=2>as:</FONT></DIV>
 > <DIV><FONT color=#000000 size=2></FONT>&nbsp;</DIV>
 > <DIV><FONT color=#000000 size=2>Popup foo {</FONT></DIV>
 > <DIV><FONT color=#000000 size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
 > &quot;bar&quot; Exec nop</FONT></DIV>
 > <DIV><FONT size=2>}</FONT></DIV>
 > <DIV><FONT color=#000000 size=2></FONT>&nbsp;</DIV>
 > <DIV><FONT color=#000000 size=2>Could I have a module &quot;Read&quot; a file 
 > that would redefine the foo Popup such that the</FONT></DIV>
 > <DIV><FONT color=#000000 size=2></FONT><FONT size=2>entries and the actions 
 > change such as:</FONT></DIV>
 > <DIV><FONT color=#000000 size=2>
 > <DIV><FONT color=#000000 size=2>Popup foo {</FONT></DIV>
 > <DIV><FONT color=#000000 size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
 > &quot;fum&quot; Exec ls</FONT></DIV>
 > <DIV><FONT size=2>}</FONT></DIV>
 > <DIV>Or must I always restart fvwm2?&nbsp; 
 > Thanks.</DIV></FONT></DIV></BODY></HTML>
--
Visit the official FVWM web page at <URL: http://fvwm.math.uh.edu/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Neil Bird <[email-masked]>
Date: Thu, 21 Jan 1999 08:55:31 +0000

Jim Nicholson wrote:
>  > to fvwm.  I was wondering if menus could be made to be dynamic?  ...

  Hmm. Not quite, if he's after what I tried to do. I wanted to emulate
olvwm's DIRLIST submenu option, which hangs a submenu off an entry that's
created on the fly (in this case, the contents of a directory).

  Now, I've done something /similar/ by writing a script DirMenu that
recreates a menu '_DirMenu' & 'Popup's it when it's called, which is with
something like:

+ "List Dir" Read 'DirMenu /some/where'

  Although this works, 'List Dir' is a terminating menu entry (i.e., no
submenu) - I have to actually select it, lose the current menu-tree, then
have the _DirMenu popup.

  What I think Mr. Straub was after was what I was trying for: a /dynamic/
submenu. I couldn't see a way to implement this (from 'man fvwm2'), but
may have missed somthing.

  And if that's /not/ what he was on about, then sorry for hijacking the
thread!

-- 
========================- http://www.rrds.co.uk/ -======================
 Neil Bird                   |   This is who we are     The time is near
                             |        There are 345 days remaining
 mailto:[email-masked] |                           [ T-138 days! ]
--
Visit the official FVWM web page at <URL: http://fvwm.math.uh.edu/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Michael Han <[email-masked]>
Date: Thu, 21 Jan 1999 09:55:05 -0800

Previously...
>  And if that's /not/ what he was on about, then sorry for hijacking the

Hrmm, your description seems pretty accurate, regardless of whether
the original questioner was asking this in specific or not... I've
bumped into the same thing, writing silly little hacks in fvwmperl. I
really overload my fvwm menus. Given that Functions and Menus are
stored identically in fvwm2, it now occurs to me that there might be a
way to sneak functions into a menu invocation somehow.

Anyhow, I usually do this when I want to do a dynamic menu:

AddToFunc	DynamicMenuFunctionFoo	I	PipeRead foo

Where foo is responsible for returning a DestroyMenu, AddToMenu, PopUp
stream. Then I can do a:

AddToMenu	DynamicMenuParent	"a dynamic menu" DynamicMenuFunctionFoo

I think I see a way to maybe do this and keep the dynamic menu as part
of the menu tree...
-- 
[email-masked]
It's potato, not potatoe
 - The collected wisdom of Bart Simpson
--
Visit the official FVWM web page at <URL: http://fvwm.math.uh.edu/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].