MissingSubmenuFunction

I want to create some Submenus “on-the-fly” with “MissingSubmenuFunction”
So i created 3 Functions, they create this three Submenus. It works.

BUT

I can use only one MissingSubmenuFunction per each menu. I have a Submenu “Windowmanager”, an in this Submenu i want to have one Menu from which i can choose a Wallpaper, the Fvwm-Manpages and the Fvwm-Modules. And i want to create this Submenus from the current content.
If i put into the “Windowmanger”-Submenu three times “MissingSubmenuFunktion”, only the last one workes. And i have no idea, ho to make a branch to the 3 functions with the test-command in case of the given directory-path, the content of $0…

The Submenu “Windowmanager”:

[code]DestroyMenu THISWM_MENU_popup
AddToMenu THISWM_MENU_popup “WindowManager” Title

  • MissingSubmenuFunction WM_MENU_FUNC
    #+ MissingSubmenuFunction WallpaperBrowser
  • Wallpaper Popup “/home/jakob/Wallpaper”
    • “” Nop
      #+ MissingSubmenuFunction ModuleBrowser
  • “Module” Popup “$[FVWM_MODULEDIR]”
    #+ MissingSubmenuFunction ManpageBrowser
  • “Fvwm-Manpages-dynamic” Popup “/usr/share/man/man1”
  • “Fvwm-Manpages” Popup manpages_popup
    • “” Nop
  • “Fvwm2-Manpage” Exec xterm -e man fvwm
    • “” Nop
  • “Restart Fvwm2” Restart
    • “” Nop
  • “Exit” Quit
    [/code]

And the three (4) functions

[code]#####

Example: http://dev.gentoo.org/~taviso/screenshots/may04a-fvwm.png

Remember, fvwm-root only works with png and xpm, if you use lots of jpg, try changing this

to Esetroot, or similar.

If you have xv installed, clicking the title will start a slide show.

###############
DestroyFunc WallpaperBrowser
AddToFunc WallpaperBrowser I PipeRead ‘test ! -d “$0/.thumbs” && mkdir “$0/.thumbs”;
for i in “$0/”; do
test -f "$0/.thumbs/${i##
/}"
-a “${i}” -ot “$0/.thumbs/${i##/}" || {
convert -quality 0 -scale 42 “${i}” "png:$0/.thumbs/${i##
/}” 2>/dev/null
|| continue;
};
done;
fvwm-menu-directory --icon-title folder_view.png --icon-file PIXMAP
–icon-dir folder_paper_closed.png --dir “$0” --exec-file “^$[fvwm_wallpapersetter]”
–exec-t="^xv -wait 2 " | sed -e “s#FuncFvwmMenuDirectory#WallpaperBrowser#g”
-e "s#PIXMAP\(.
\)\"\(./\)\(.\)\"#\2.thumbs/\3\1\2\3#g"’

[/code]

[code]##############################################################################

>>> MODULE

##############################################################################

(jakob´s config)

DestroyFunc ModuleBrowser
AddToFunc ModuleBrowser I PipeRead ‘fvwm-menu-directory --icon-title folder_view.png --icon-dir folder_paper_closed.png
–dir $[FVWM_MODULEDIR] --title “” --exec-file “^Module” |
sed -e “s#Exec xterm -e##g” -e “s#$[FVWM_MODULEDIR]/##g” -e “s#Fvwm##1” -e “s#\”##3" -e “s#\”##3"’

[/code]

[code]##############################################################################

>>> MANPAGES

##############################################################################

(jakob´s config)

DestroyFunc ManpageBrowser
AddToFunc ManpageBrowser I PipeRead 'fvwm-menu-directory --icon-title folder_view.png --icon-dir folder_paper_closed.png
–dir “/usr/share/man/man1” --title “” --exec-file “^xterm -e man” |
grep “^Destroy\|^AddTo\|^+ Dynamic\|^+ Missing\|^+ \“Fvwm*”|sed -e “s#\.1\.gz##g” -e “s#/usr/share/man/man1/##g” -e “s#\”##3” -e “s#\”##3" ’
[/code]

[code]##############################################################################

>>> LOGINS

##############################################################################

(jakob´s config)

#DestroyFunc LoginsPopup
#AddToFunc LoginsPopup
#+ I Destroy recreate “Logins-dynamic”
#+ I AddToMenu “Logins-dynamic”
#+ I PipeRead ‘cat $[HOME]/.fvwm_button_shells|grep ‘^[^#]’|while read a b e; do echo " + %$b%$a $e"; done’
[/code]

This is the current Function, where i tried to make a branch. But i have no idea, how it works…

[code]##############################################################################

>>> WM-Menu

##############################################################################

(jakob´s config)

DestroyFunc WM_MENU_FUNC
AddToFunc WM_MENU_FUNC

  • I Echo $0
    #+ I test ( True “/usr/share/man/man1” ) Function ManpageBrowser
  • I test ( True ) Function ManpageBrowser
  • I test ( EnvMatch $0 “$[FVWM_MODULEDIR]” ) Function ModuleBrowser
  • I test ( EnvMatch $0 “/home/jakob/Wallpaper” ) Function WallpaperBrowser
    [/code]

regards
scientific

What are you testing for here? Your “Test (True)” line amounts to the same thing as:

+ I ManpageBrowser

So I am not sure what you’re trying to achieve. Note that you might have meant this:

+ I Test (F /usr/share/man/man1") ManpageBrowser

This might be OK – depends. Note though a couple of points (I am not prepared to wade through your menuing config – that’s your job:

  • The keyword “Function” only applies if it servers to disambiguate between an internal command or a module – in your case neiter “ManpageBrowser”, “ModuleBrowser” or “WallpaperBrowser” are either, so you can just use those names directly.

  • When calling these functions, I assume you’re then checking to see the menu needs to be recreated? I hope you’re using “DestroyMenu recreate foo” when doing this – and note that you might also want to simply create the toplevel menus in the documented way, and then add them as submenus to existing menus.

– Thomas Adam

Oh… I´ve forgotten to delete this line. It was only a test, how this command works… :wink:

No, it should be the same as down.

[code]

  • I Test (EnvMatch $0 “/usr/share/man/man1”) ManpageBrowser

The Problem is, it doesn´t work. When the submenu f.e. /home/jakob/Wallpaper doesn´t exist, MissingSubmenuFunction calls “WM_MENU_FUNC” and the $0 contains “/home/jakob/Wallpaper”. If this is true, i want to call the Function WallpaperBrowser.
The Result is, with this Syntax, the Function isn´t called, the Submenu isn´t created.

If i negate one of this test-calls, and touch the line in the Menu, the correct Submenu will be created and appeares…

I hope, you understand, what i mean.

regards

scientific

Now i changed the Function into

[code]##############################################################################

>>> WM-Menu

##############################################################################

(jakob´s config)

DestroyFunc WM_MENU_FUNC
AddToFunc WM_MENU_FUNC

  • I SetEnv d $0
  • I Echo $0 $d
  • I test ( EnvMatch $d “/usr/share/man/man1” ) ManpageBrowser
  • I test ( EnvMatch $d “$[FVWM_MODULEDIR]” ) Function ModuleBrowser
  • I test ( EnvMatch $d “/home/jakob/Wallpaper” ) Function WallpaperBrowser
    [/code]

The Echo-Line replies for $0 the name of the called directory (the name of the submenu btw.) and $d i 0

no idea??? :frowning: