Subject: Building menu w/ fvwm functions

From: parv <[email-masked]>
Date: Tue, 8 Jul 2003 19:36:58 -0400

FVWM version i am using is 2.5.7.

I was trying to build a menu ("bg-menu" in this case) entries w/
help of a fvwm function ("bg-solid-add-menu") ...

  DestroyFunc  bg-solid-add-menu
  AddToFunc    bg-solid-add-menu
  # 0: menu name, 1: color name, 2: color value
  + I AddToMenu $0 "$1 - $2"  Exec xsetroot -solid $2

  DestroyMenu  bg-menu
  AddToMenu    bg-menu background  Title
  +  Function bg-solid-add-menu  bg-menu black black
  +  Function bg-solid-add-menu  bg-menu grey grey55

...but that leaves only "Function" named entries which do nothing.
(It is as if "Function" is not special when not used as an menu
action.)

(I know about "PipeRead" & "DynamicPopupAction", and thought that
they would not of help.  From the description of PipeRead, it
seems to execute only external commands, not the functions.  And
"DynamicPop*" functions would act/be usable only on pop up menus.)

What would be the correct way, short of executing external commands,
to use a fvwm function to build a menu?

(I have some faint memory of somebody's creation which created menu
entries and key bindings from one set of specification.  In any
case, i failed to find anything relevant at
http://www.mail-archive.com/[email-masked]/.)

Thanks for reading till here.

  - Parv

-- 
A programmer, budding Unix system administrator, and amateur photographer
ISO employment: http://www103.pair.com/parv/work/

--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]

---

From: Mikhael Goikhman <[email-masked]>
Date: Wed, 9 Jul 2003 00:21:11 +0000

>   +  Function bg-solid-add-menu  bg-menu grey grey55

Remove "+" in the last 2 lines and it will work for you. Or just:

  bg-solid-add-menu  bg-menu black black
  bg-solid-add-menu  bg-menu grey grey55

> to use a fvwm function to build a menu?

You may do this line to create your menu:

  PipeRead `perl -e 'foreach ("black - black", "grey - grey55") { / - /; print qq(AddToMenu bg-menu "$_" Exec xsetroot -solid $'"'"'\\n); }'`

  Popup bg-menu

The original perl print command (after all escapes) looks like:

  print qq(AddToMenu bg-menu "$_" Exec xsetroot -solid $'\n);

Regards,
Mikhael.

---

From: parv <[email-masked]>
Date: Tue, 8 Jul 2003 21:36:54 -0400

in message <[email-masked]>,
wrote Mikhael Goikhman thusly...
>   bg-solid-add-menu  bg-menu grey grey55

Whoopee!  That did it; thanks much.

This point (about not putting '+' to execute function in place, in
a menu) seems to be missing from the fvwm(1) page.  Only thing
i found....

  +     Used to continue adding to the last specified decor, function
        or menu.  See the  discussion  for  AddToDecor,  AddToFunc,
        and AddToMenu.

...there is no mention about the above in any of AddTo* sections.
Oh well.

(As to your perl code, i meant originally that i would *much* prefer a
fvwm solution before resorting to shell or perl. Thanks anyway.)

  - Parv

-- 
A programmer, budding Unix system administrator, and amateur photographer
seeks employment:  http://www103.pair.com/parv/work/

---

From: Mikhael Goikhman <[email-masked]>
Date: Wed, 9 Jul 2003 12:39:29 +0000

On 08 Jul 2003 21:36:54 -0400, parv wrote:
> a menu) seems to be missing from the fvwm(1) page.

The Function lines without "+" do not belong to the last AddToMenu.
They just happen to extend the same menu, but they may be placed
anywhere after adding the title of the menu.

> Only thing i found....

Your original posted code does exactly what is explained, it continues to
add menu item to the last "AddToMenu bg-menu", the name of these items is
"Function" and they call your function bg-solid-add-menu with parameters.

If you actually run the original code above, do "Popup bg-menu", choose
some item named "Function" this same menu bg-menu gets extended with real
"black - black" items, that you may see on the next "Popup bg-menu".

I don't think any documentation is missing, maybe just add a more
explicit note in the first paragraph of the new MENUS section that
AddToMenu commands must not be continuous, one can remove or extend any
menu at any point dynamically.

Regards,
Mikhael.