two questions

  1. how to give multi commands in the menu action? for example: i want to start xscreensaver and then run “xscreensaver-command -lock” with a voice of the menu

  2. how to test if an application is already running?

thanks in advance!

There are two easy ways to do it. You can call a Function that performs the actions in the desired order like this:

[code]AddToFunc LaunchXScreenSaver

  • I Exec exec xscreensaver
  • I Exec exec xscreensaver-command-lock

AddToMenu FooMenu “start xscreensaver and lock screen” Function LaunchXScreenSaver[/code]

Or you can use a PipeRead in your menu entry to do both commands:

[code]AddToMenu FooMenu

  • “start xscreensaver and lock screen” PipeRead “echo Exec exec xscreensaver; echo Exec exec xscreensaver-command-lock”[/code]

You could test to see if a window exists that has the class/resource/name as the window that app would have:

[code]AddToFunc Foo

  • I Any (Firefox-bin, Gecko) firefox exists
  • I TestRc (NoMatch) firefox doesn’t exist[/code]

Alternately, you could use PipeRead to call ps:

PipeRead "ps -ef | grep [f]irefox-bin && **firefox exists action** || **firefox doesn't exist action**"

I don’t know if there are advantages of one over the other. Do whatever you feel most comfortable with.


thanks a lot flatline :exclamation:
now i have one more question: suppose to have classic thumbnail and dethumbnail functions… when i click with button 1 on fvwmiconman my code tests if the window is not iconic and then run thumbnail… then tests if the window is iconic and run dethumbnail… so the window goes iconified and immediately deiconified :cry: so, never iconified… what is the right code?

perhaps i can use your previous suggestion and make another function… for exapmle[code]AddToFunc ThumbItOrDethumbIt

  • I ThisWindow (Iconic) thumbnail
  • I TestRc (NoMatch) dethumbnail[/code]but i doubt i have understood…don’t i :question:

Yeah, I think that should work (assuming I’ve understood your description).


it works :exclamation: i love you!

Heavens, no. That’s horrid. However:

None (Gecko) Exec exec firefox

Is much better, or whatever you wanted to do if the specific class of the window does not exist.

– Thomas Adam

my problem is that i’ve got to test if xcompmgr is running and it doen’t work… perhaps because it is not a window

PipeRead '[ "$(pidof xcompmgr)" ] && echo Echo "Running"'

You should have stated that before, FVWM is a Window Manager, not an all-purpose-bash-masquerader.

– Thomas Adam

Ah, yes. I’m still not as familiar as I should be with the variety of conditional commands and am far too willing to revert back to my bash habits.


thanks guys for your suggestions!
about xcompmgr command… i placed it in .xinitrc… it works fine!