Subject: FVWM: Preventing mult Instances of Applications?

From: [email-masked]
Date: Thu, 12 Feb 1998 21:16:39 -0800 (PST)

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.
--
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 [email-masked].
To report problems, send mail to [email-masked].

---

From: [email-masked]
Date: Fri, 13 Feb 1998 01:13:43 -0500 (EST)

On Thu, 12 Feb 1998 [email-masked] 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.

Begin3
Title:          xcmd
Version:        1.7
Entered-date:   04JAN98
Description:    Xcmd is a front-end for starting programs under X11.
                You can tell xcmd to look for a window with a specific
                class, resource name, or title string (using the
                `--find-<property>' options); if it finds one or more,
                xcmd will `raise' them, otherwise it will run the
                command you specify. You can tell xcmd to run commands
                that create their own windows (using `--xcmd'), or to
                run commands inside a terminal window (using `--cmd')
                with various options.
Keywords:       X11, xterm, rxvt, command, utility, xwit, xwininfo
Author:         Jim Knoble <[email-masked]>
Maintained-by:  Jim Knoble <[email-masked]>
Primary-site:   sunsite.unc.edu /pub/Linux/X11/xutils
                17kB xcmd-1.7.tar.gz
Alternate-site: 
Original-site:  
Platforms:      X11R6
Copying-policy: GPL
End

--jim

%%%%%%%%%%%%%%% jim knoble %%%%%%%% [email-masked] %%%%%%%%%%%%%%%%%

---

From: [email-masked]
Date: Fri, 13 Feb 1998 08:27:24 -0500 (EST)

> 'F12' key-press just raise the first application, instead of opening 

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();                                      [email-masked]

     "Sometimes it happens.  People just explode.  Natural causes."

---

From: Wesley Hart <[email-masked]>
Date: Fri, 13 Feb 1998 10:06:13 -0600

> 'F12' key-press just raise the first application, instead of opening 

Here's what I use:

} Key F2		A	C	NetscapeFunction
} ...
} DestroyFunc Goto
} AddToFunc Goto \
}   "I" Iconify -1
} + "I" WindowShade 2
} + "I" Focus
} + "I" WarpToWindow 50 50 
} 
} DestroyFunc NetscapeFunction
} AddToFunc   NetscapeFunction \
}   "I" Next [Navigator] Goto
} + "I" None [Navigator] GotoPage 0 1
} + "I" None [Navigator] Exec netscape -install -geometry =624x800-120+86

It works as you describe.  However, I have trouble getting 'Next' to
work with FvwmButtons - the following doesn't work as I expect.  I
get additional instances of FvwmButtons each time the function gets
executed.  Fvwm doesn't produce any error messages while defining or
executing the function.  Any ideas why this doesn't work?

} Key F4		A	C	ButtonFunc
} ...
} DestroyFunc ButtonFunc
} AddToFunc   ButtonFunc \
}   "I" Next [FvwmButtons] Iconify 
} + "I" None [FvwmButtons] Module FvwmButtons

-- 
Wesley Hart

		Paranoia is just another name for a heightened 
		appreciation of how badly the Universe wants to get you.
--
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 [email-masked].
To report problems, send mail to [email-masked].

---

From: [email-masked]
Date: Fri, 13 Feb 1998 11:12:52 -0500 (EST)

> executing the function.  Any ideas why this doesn't work?

A lot of configuration files set FvwmButtons to CirculateSkip, which
means that "Next" won't find it.  Try:

  "I" Next ["FvwmButtons" CirculateHit] Goto
+ "I" None ["FvwmButtons" CirculateHit] Module FvwmButtons

---

From: Wesley Hart <[email-masked]>
Date: Fri, 13 Feb 1998 10:42:13 -0600

> + "I" None ["FvwmButtons" CirculateHit] Module FvwmButtons

Looks like CirculateSkip was the culprit - it works now.
Thanks for the tip!

-- 
Wesley Hart

	You can't spell 'Whole berry treats' without 'Robert Wesley Hart'.