Subject: FVWM: Swallow and Exec from one FvwmButton

From: Tim Phipps <[email-masked]>
Date: Mon, 10 Jun 1996 16:16:18 +0100

Is it possible to have a button that does a swallow and have another
action tied to the button name?

The reason I ask is that I'm trying to set up a cluster monitor panel
which is basically nine xloads in a vertical button bar.  I have a label
for each button with the host name in it and would like to run a terminal
on that machine when the button is pressed.  I could do it with a button
for the xload with a button for the hostname underneath but the geometry
gets messy as I only want a small buttons for the names and the xloads
to take up the rest of the space.  With a combined swallow and label I
get this automatically.

Cheers,
Tim Phipps.
--
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] (Albrecht Kadlec)
Date: Tue, 11 Jun 96 10:39:40 +0200

>>>>> Tim Phipps writes:

T> Is it possible to have a button that does a swallow and have another
T> action tied to the button name?

T> The reason I ask is that I'm trying to set up a cluster monitor panel
T> which is basically nine xloads in a vertical button bar.  I have a label
T> for each button with the host name in it and would like to run a terminal
T> on that machine when the button is pressed.  I could do it with a button
T> for the xload with a button for the hostname underneath but the geometry
T> gets messy as I only want a small buttons for the names and the xloads
T> to take up the rest of the space.  With a combined swallow and label I
T> get this automatically.

T> Cheers,
T> Tim Phipps.

this is a frequently requested feature :-)
this is from my archive:
Date: Mon, 13 May 96 19:50:34 +0200

>>>>> Jens-U H Petersen writes:

J> (Thanks for the new Buttons, Jarl!  It's great.)
I can't just add anything to that. (needed some time to find out HOW
powerful it is)

J> Does anyone have a working example of a (mouse) action binding in
J> a swallowed button: I have the following in ".fvwm2rc"

J> ---- Start of included text -----------------------8<--- cut here -------------
J> *FvwmButtons(Swallow(UseOld) "xload1" "Exec xload -font 6x10
J> -background PeachPuff2 -title xload1 -hl yellow -update 5 -scale
J> 2 -geometry -1500-1500 &", Action 'Exec "top@clove" xterm -title
J> top@clove -e top') 
J> ---- End of included text -------------------------8<--- and here -------------
As I see it, your problem is, that once an application is swallowed, 
X events are handed to it unfiltered (since it could depend on them -
imagine a swallowed pager, which can't receive any mouse event)

The only example I saw, where an action AND a swallow command was
specified, was Jarls example in the man page.
But that's a swallow with a NOP. (capture existing window, or wait 
till a window with that name appears.)
So if no window of that name exists/appears, the "button" is a real 
button, which executes the associated action. 
If the action starts a window with the long-awaited name, the button 
gets REPLACED by the swallowed application, so no more invocations of 
the application are possible.

So I don't think it is possible, what you want to do, unless someone 
modifies FvwmButtons to intercept events for swallowed applications.

That the return does trigger the action... hmm.
Might be that this is because xload sets the Mwmhints input to false 
("I never ever want the keyboard focus." - note: I'm not an X programmer,
I've just been following the discussion here for a long time.)

I just checked: 
	I can reproduce the xload behaviour.
	The action doesn't work, if put on a swallowed perfmeter.
		(this does react to keystrokes.)
	xbiff also refuses keystrokes, and the action works.

Seem like I guessed right with the motif input hint.

Is there any similar hint for mouse input? (some sort of SkipFocus flag?)
Can we simulate that, or can we just filter the Event stream to the
application without any hint.

J> But the only way that I can run "top" is by pressing the return
J> key on the button (clicking with the mouse does nothing).

J> If instead I put

J> ---- Start of included text -----------------------8<--- cut here -------------
J> *FvwmButtons(Swallow(UseOld) "xload1" "Exec xload -font 6x10
J> -background PeachPuff2 -title xload1 -hl yellow -update 5 -scale
J> 2 -geometry -1500-1500 &", Action(Mouse 1) 'Exec "top@clove"
J> xterm -title top@clove -e top') 
J> ---- End of included text -------------------------8<--- and here -------------

J> Again nothing happens with mouse clicks, but FvwmButtons crashes
J> with some X error when return is pressed.

I got this one:

X Error (intercepted): BadDrawable (invalid Pixmap or Window parameter)
Major Request Code   : 62
Minor Request Code   : 0
Resource ID (XID)    : 31457301
Error Serial Number  : 706

Don't know why the generic mouse action does work, and the mouse n doesn't.

J> Also I don't understand why the examples of UseOld in the manual
J> all combine it with NoKill, when "NoKill" is the default anyway,
J> isn't it?  Even with UseOld, is I restart fvwm2 a couple of
J> times, it seems to miss xload's, swisswatch regularly :-(

I think Jarl meant NoClose to be used in conjunction with UseOld, in order
to swallow old apps/unswallow them on exit.

But this only works, when I do a "killmodule FvwmButtons" from FvwmTalk.
If I restart Fvwm2, new xbiff/xclock/console/perfmeter are created, while
the old processes are still alive, though they're NOT mapped anywhere.

(And I deleted the -geometry -1500-1500 as well as I set WindowListHit,
ShowMapping, Icon and Title styles.)

hope this triggers some more thoughts.
albrecht
-- 
Overhead the albatross hangs	    |  And everything is green and submarine
Motionless upon the air		    |  And no one showed us to the land
And deep beneath the rolling waves  |  And no one knows the wheres or whys

In labyrinths of coral caves	    |  But something stares
The echo of a distant tide	    |  And something tries
Comes willowing across the sand     |  And starts to climb towards the light
							-- Pink Floyd, "Echoes"
--
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: Alan Wild <[email-masked]>
Date: Tue, 11 Jun 1996 15:40:04 -0400 (EDT)

> But this only works, when I do a "killmodule FvwmButtons" from FvwmTalk.

This feature (the UseOld/NoKill) option allows a user to start programs
from their .xsession file and then Swallow them into FvwmButtons.  I
orignally suggested this idea to Jarl because I occasionally have to use
multiple window managers (HP VUE, CDE, et al.) and I only want to have
to start my clocks and xbiffs once.  Using these attributes lets
FvwmButtons grab a window that was running previous to the start of
FvwmButtons and then Release the window when it closes.

-Alan
-- 
Alan Wild                            [email-masked]       
f/s/c lou95                      http://www.spd.louisville.edu/~triangle/
IT-HSC Consultant                 http://www.spd.louisville.edu/~arwild01
--
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: Todd Tyrone Fries <[email-masked]>
Date: Tue, 11 Jun 1996 04:27:05 -0500 (CDT)

> action tied to the button name?

As has been pointed out tkgoodstuff will do this for you now.

> to take up the rest of the space.  With a combined swallow and label I

You can specify in the xload that no title be used, then create a small
button above the xload with the name of the machine which can be used to
click on to Exec what you wanted...

For example:

Module FvwmButtons /tmp/configfile

/tmp/configfile:

(9x1, Container(Padding 0 0,Frame 0,Fore black,Back white,Rows 6,Columns 9))
 (1x1,Title m1)
 (1x1,Title m2)
 (1x1,Title m3)
....
 (1x5,Swallow (NoTitle) xload)
....
 (End)

Except that didn't work when I tried it...argh...but you do get the idea
I hope...

--
Todd Fries .. [email-masked] .. [email-masked] .. [email-masked]

---

From: [email-masked] (Albrecht Kadlec)
Date: Thu, 13 Jun 96 11:40:04 +0200

>>>>> Alan Wild writes:

> But this only works, when I do a "killmodule FvwmButtons" from FvwmTalk.

A> This feature (the UseOld/NoKill) option allows a user to start programs
A> from their .xsession file and then Swallow them into FvwmButtons.  I
A> orignally suggested this idea to Jarl because I occasionally have to use
A> multiple window managers (HP VUE, CDE, et al.) and I only want to have
A> to start my clocks and xbiffs once.  Using these attributes lets
A> FvwmButtons grab a window that was running previous to the start of
A> FvwmButtons and then Release the window when it closes.

consequently, at the restart of fvwm2 the new fvwmButtons should be able to
recapture the same window (process).
But the problem is that the window is lost.
The process still exists, but there is no mapping on any page.

so the new FvwmButton (in doubt) creates a new xclock/xbiff, every time I
restart.

Unswallowing only works correctly, if I do a killmodule FvwmButtons from
FvwmTalk. 

albrecht
-- 
And the man in the mirror has sad eyes.  -- Marillion

---

From: Alan Wild <[email-masked]>
Date: Thu, 13 Jun 1996 09:15:18 -0400 (EDT)

> The process still exists, but there is no mapping on any page.

I must admit that I didn't experience this problem while I was BETA
testing Jarl's patches.  Unfortunately, the machines I was using at the
time are in Oregon, and I have returned to classes here in Kentucky.
I'll try and play around today and see if I can duplicate this.

BTW, *ANYONE* able to duplicate any of the BUGS I have reported
involvinging the FvwmPager Module being Swallowed by FvwmButtons?
Specifically using the Swallow(Respawn) Attribute and trying to move
windows in between the desktops ON the pager?

-Alan