On Sat, Aug 16, 2014 at 08:05:11AM +0100, Jamie Griffin wrote: > What I've got so far is two functions: one that checks the top > taskbar, stops it if it's open and then opens the bottom dock; the > other function does the same but for the other fvwmbuttons dock. > Here they are: > > DestroyFunc OpenDock > AddToFunc OpenDock > + I All (Panel) Close > + I TestRc (NoMatch) KillModule Panel
Is there a specific reason why you try to kill the module in two different ways? The first line might also kill other windows. Anyway, for the scripting you might want to give the modules a unique name. > + I TestRc (Match) Module FvwmButtons Dock -g +300-0 > > DestroyFunc OpenPanel > AddToFunc OpenPanel > + I All (Dock) Close > + I TestRc (NoMatch) KillModule Dock > + I TestRc (Match) Module FvwmButtons Panel -g $[vp.width]x24+0+0 > > The problem with this approach is I have to have them bound to > separate key strokes. When I first create the keybindings it's > possible I might forget which one is which and so if I press the > wrong one, it doesn't handle that well. I'd much prefer it to be > bound to a single key stroke and have it check which instance is > open, then close the open fvwmbuttons and start the other, as I > mentioned. > > I'd be very grateful if anyone could offer a solution or some help. You can use a wrapper function: DestroyFunc ClosePanelOpenDock AddToFunc ClosePanelOpenDock + I All (Panel) Close ... (Better use killmodule instead of close.) DestroyFunc CloseDockOpenPanel AddToFunc CloseDockOpenPanel + I All (Dock) Close ... DestroyFunc SwitchPanelOrDock AddToFunc SwitchPanelOrDock + I Next (Panel) ClosePanelOpenDock + I TestRc (nomatch) CloseDockOpenPanel key f1 a n switchpanelordock As a little example for advanced scripting in complex functions: THere is a function in my config that (1) starts a certain application if it's not already running, (2) closes it if it's running, on the current page and not iconified, shaded etc., (3) makes the window visible on the current page if the application is running but not on the current page, or iconified, shaded etc. #// #// Application toggling function #// #// first argument is the window name, second argument is the command to start #// the application. 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 AddToFunc MakeVisible + I MoveToDesk + I MoveToPage + I MoveToScreen + I Iconify off + I WindowShade off + I Raise Example uses: AddToFunc ToggleFvwmConsole + I ToggleWindow FvwmConsole "Module FvwmConsole" More complex example: AddToFunc RunXMessages + I Exec rxvt -geometry -0-0 -T XMessages -n XMessages -e tail -f ~/.X.err AddToFunc ToggleXMessages + I ToggleWindow XMessages "Function RunXMessages" Ciao Dominik ^_^ ^_^ -- Dominik Vogt