Re: FVWM: fvwm toggle button

From: Dominik Vogt <fvwm_at_fvwm.org>
Date: Mon, 13 May 2002 12:09:34 +0200

On Fri, May 10, 2002 at 11:56:31PM +0200, Jodok Ole Müllers wrote:
> Hi,
>
> Has anybody an idea how to ceate a "toggle" button.
> I want to press it and if the winlist is off it will turn it on
> and if it is on it will turn it of.
>
> Pseuydocode:
>
> ...
> *FvwmButtons(Title "Toggle Winlist",ActionToggleFvwmWinlist )
> ....
>
>
> AddToFunc ToggleFvwmWinlist
> + Module FvwmWinList if WinListIsOff
> + KillModule FvwmWinList if WinListIsOn

This is what our FAQ says (example from my config file):

7.12 Toggling windows on and off.
                                                                                
   It is often desirable to have a menu item of perhaps a button in
   FvwmButtons or FvwmWharf that launches an application when used
   the first time and closes it if used a second time. Although it
   is not obvious how to do this, it is possible. Let's assume you
   need a menu item that toggles an FvwmConsole window on and off.
   Then put the following lines in your .fvwm2rc:
                                                                                
     AddToFunc ToggleFvwmConsole
     + I None (FvwmConsole) Module FvwmConsole
     + I Next (CurrentPage Visible FvwmConsole) Close
     + I Next (FvwmConsole) MoveToDesk
     + I Next (FvwmConsole) MoveToPage
     + I Next (FvwmConsole) Raise
                                                                                
     AddToMenu <some menu>
     + "toggle FvwmConsole" Function ToggleFvwmConsole
                                                                                
   Or if you prefer a button in the button bar:
                                                                                
     *FvwmButtons(Action ToggleFvwmConsole)
                                                                                
   The lines with MoveToDesk, MoveToPage and Raise will bring the
   window to the top of the current page if it is not visible
   instead of closing it.
                                                                                
   If you want to toggle one specific window, e.g. an xterm, but
   still want to have other xterms that are not toggled, you must
   give the window an unique name:
                                                                                
     AddToFunc ToggleXMessages
     + I None (XMessages) Exec ( TERM -T XMessages -n XMessages \
         -e exec tail -f /var/adm/?* ~/.X.err )
     + I Next (XMessages) Close
                                                                                
   Or for a toggling Netscape button:
                                                                                
     AddToFunc ToggleNetscape
     + I None (Navigator) Exec exec netscape
     + I All (Navigator) Close
                                                                                
   Keep in mind that these functions simply check if a window with
   the specified name exists. They will happily close manually
   opened windows or launch an application multiple times if the
   application is slow to start (e.g. like netscape).
                                                                                
Bye

Dominik ^_^ ^_^

-- 
Dominik Vogt, email: d.vogt_at_lifebits.de
LifeBits Aktiengesellschaft, Albrechtstr. 9, D-72072 Tuebingen
fon: ++49 (0) 7071/7965-0, fax: ++49 (0) 7071/7965-20
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_fvwm.org.
To report problems, send mail to fvwm-owner_at_fvwm.org.
Received on Mon May 13 2002 - 08:56:13 BST

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:37:53 BST