Calling a file options menu from a file

I want to call a file-option menu from within a directory browser, for each file which is in a given directrory. The file option menu has entries such as ‘view’, ‘edit’, etc. Atm I’m trying to do this using fvwm-menu-directory, but I can’t get it working, as when I use the --command-file option, I do not seem to be able to either remember the file from which the menu is called, or echo it to some file, so I can use the content later using cat.
Here is more or less what I have:

SetEnv daemons $[FVWM_USERDIR]/archwd-user/pkg/Daemons
SetEnv layouts $[FVWM_USERDIR]/archwd-user/pkg/Layouts
SetEnv modules $[FVWM_USERDIR]/archwd-user/pkg/Modules
SetEnv view $[FVWM_USERDIR]/archwd-user/scripts/view
SetEnv edit $[FVWM_USERDIR]/archwd-user/scripts/edit

DestroyFunc FuncFvwmMenuDirectory
AddToFunc FuncFvwmMenuDirectory	
+ I PipeRead 'fvwm-menu-directory -d '$0' --title '%d' --command-file "Popup MenuFileOptions"'

###### Adding to menu
AddToMenu MenuApplications
+ "DirBrowser"	Popup MenuArch

DestroyMenu 'MenuArch'
AddToMenu MenuArch
+ MissingSubmenuFunction FuncFvwmMenuDirectory
+ " Deamons" Popup $[daemons] 
+ " Layouts" Popup $[layouts]
+ " Modules" Popup $[modules] 

DestroyMenu 'MenuFileOptions'
AddToMenu MenuFileOptions
+ "View" Exec exec $[view]
+ "Edit" Exec exec $[edit]
# some other functions should be added here

The scripts I call are most likely simple bash scripts invoking Xdialog, so something like

Xdialog --textbox $0 20 60

Thanks :smiley:

You were so close, too. You can make use of the “%f” variable to ‘fvwm-menu-directory’ to do this. This appends the full path plus filename. In this way, I then used a function to build the menu. A bit different to what you were doing, but it demonstrates the purpose. The following illustrate the two changes to your code, as above:

DestroyFunc FuncFvwmMenuDirectory
AddToFunc FuncFvwmMenuDirectory    
+ I PipeRead 'fvwm-menu-directory -d '$0' --title '%d' --command-file "Function fooMenu '%f'"

DestroyFunc fooMenu
AddToFunc fooMenu
+ I DestroyMenu recreate MenuFileOptions
+ I AddToMenu MenuFileOptions Edit Exec rxvt -e vi $0
+ I AddToMenu MenuFileOptions View Exec rxvt -e less $0
+ I Popup MenuFileOptions

Or you can use your SetEnvs. Upto you.

– Thomas Adam

Thanks for the reply.
It does indeed do what I asked for, but the problem is (same problem I experienced before when using fvwm-command in a bash script) is that the file actually needs to be clicked for the menu to show up.
In that way the rest of the menu dissapears.
I would like it to be that when going over the file without clicking the menu shows up (so like a directory).
You know if this is possible, as it seemes that only the ‘–command-file "popup…’ supports this?

Not easily. The solution I propsed to you is about the best you’ll get currently. I can’t think of any other way of doing it, alas.

– Thomas Adam

Okay, now I know at least that there is no straight solution.
I changed the method invoking a file-browser in Fvwm-script and calling from there editor and others (just modified a script from fvwm-themes)