Re: FVWM: Preventing mult Instances of Applications?

From: <gensch_at_zk3.dec.com>
Date: Fri, 13 Feb 1998 08:27:24 -0500 (EST)

On 12 Feb, edtawfal_at_value.net wrote:

> I have 'F12' popping up an application. How can I make the second and later
> 'F12' key-press just raise the first application, instead of opening
> another instance.

Here's something that I use:

    DestroyFunc "DoXtermButtons"
    AddToFunc "DoXtermButtons" \
      "I" Next ["XtermButtons" CirculateHit] FocusAndWarp
    + "I" None ["XtermButtons" CirculateHit] \
            Module FvwmButtons XtermButtons

    DestroyFunc "FocusAndWarp"
    AddToFunc "FocusAndWarp" \
      "I" Raise
    + "I" Focus
    + "I" Iconify -1
    + "I" WarpToWindow 50 50

    DestroyFunc "warp-to"
    AddToFunc "warp-to" \
      "I" Next [$0] FocusAndWarp

    DestroyFunc "warp-or-run"
    AddToFunc "warp-or-run" \
      "I" Next [$0] FocusAndWarp
    + "I" None [$0] $1 $2 $3 $4 $5 $6 $7 $8 $9

    Key KP_Divide A A DoXtermButtons
    Key KP_Multiply A A warp-to "xterm"
    Key KP_Subtract A A warp-to "XVile"
    Key KP_Add A A warp-or-run "Tkrat" \
            Exec /usr/local/bin/tkrat
    Key KP_Enter A A warp-or-run "Netscape" \
            Exec /usr/local/bin/netscape -ncols 100


DoXtermButtons

    Searches for an application named "XtermButtons" (ignoring the
    fact that XtermButtons has CirculateSkip style). If found,
    passes it to FocusAndWarp (see below). If not found, spawns the
    FvwmButtons module to bring up the window.

FocusAndWarp

    Raises the specified window, gives it focus, deiconifies it if
    necessary, and warps pointer to center of the window. (Helper
    function)

warp-to

    Cycle through the named windows using FocusAndWarp

warp-or-run

    Either FocusAndWarp the named application (if found), or uses the
    remaining options to run the application.


The Key definitions rebind some of the keys on my numeric keypad to do
the following:

    / Focus on XtermButtons, or run a new copy if not found
    * Cycle through my existing xterm windows
    - Cycle through my existing editor (XVile) windows
    + Focus to my mailer, or run it if not found
    Enter Cycle through exiting Netscape windows, or spawn a new
                copy if not found

-- 
(void) lar3ry();                                      gensch_at_zk3.dec.com
     "Sometimes it happens.  People just explode.  Natural causes."
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_hpc.uh.edu.
To report problems, send mail to fvwm-owner_at_hpc.uh.edu.
Received on Fri Feb 13 1998 - 07:27:50 GMT

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:38:01 BST