toggling windows on and off

Hi all:

I want to be able to toggle a window on and off using a bound key (lets say F2).

I used the code found in the FVWM::FAQ::7.12 and only changed the names so that instead of referencing FVWMConsole, it would reference FVWMFireFox. I then boud that toggle function to F2.

below is my code:

[code]Key F2 A A FuncToggleFvwmFireFox
DestroyFunc FuncToggleFvwmFireFox
AddToFunc FuncToggleFvwmFireFox
+ I ToggleWindow FvwmFireFox “Module FvwmFireFox”

 # Application toggling function
 # First argument is the window name, second argument is the
 # command to start the application.
 DestroyFunc ToggleWindow
 AddToFunc ToggleWindow
 + I None ($$0, CirculateHit) $$1
 + I TestRc (Match) Break
 + I Next (currentpage, visible, !iconic, $$0, CirculateHit) Close
 + I TestRc (Match) Break
 + I Next ($$0, CirculateHit) Function MakeVisible

 # Helper function
 AddToFunc MakeVisible
 + I MoveToDesk
 + I MoveToPage
 + I MoveToScreen
 + I Raise
 + I Iconify off
 + I WindowShade off[/code]

I thought that this is all that would be needed to be able to turn firefox on and off by pressing F2…

Anyone have any ideas?

thanks in advance,
Skender

All:
changed the :

+ I ToggleWindow FvwmFireFox "Module FvwmFireFox"

to:

+ I ToggleWindow FvwmFireFox "FvwmFireFox"

And that allows me to create 1…* instances of firefox… instead of turning firefox on and off…

Any ideas?

You’re confused. Firefox is a standalone application, and not a Fvwm module, which is the implication you’re using by having “FvwmFirefox”.

What the function does here, is passes the window to be identified, and the command to run if nothing is found. Now, firefox is ambiguous in the title it takes on. So the trick is to use the class of the firefox window – which you can ascertain from FvwmIdent. As a wordaround, and to complete this post, you can try wildcards for now:

Key F2 A A FuncToggleFvwmFireFox DestroyFunc FuncToggleFvwmFireFox AddToFunc FuncToggleFvwmFireFox + I ToggleWindow "*FireFox*" "Exec exec firefox"

HTH,

– Thomas Adam