Subject: FVWM: Query about .fvwm2-menu

From: Uncle Bulgaria <[email-masked]>
Date: 02 May 1997 14:30:01 +0100

I currently have the following in the .fvwm2-menu.

# Main menu
AddToMenu "Main"	"Main menu"	  Title
+              		"&Xterm"	  Exec xterm -geometry 170x66+0+0 -bg black -fg lightblue -cr yellow -e /opt/computing/bin/tcsh &
+              		"&Applications..."Popup Apps
+              		""		  Nop
+                       "&Modules"	  Popup Module-Popup
+              		""		  Nop
+                       "Lock Screen"     Exec xlock -remote -mode flame
+                       ""                Nop
+                       "&Restart FVWM"   Restart
+                       ""                Nop
+              		"&Quit"           Quit

The problem I'm having (Or perhaps the request I'm making?) is for some
way of getting Fvwm2 to run a script before actually quitting. The
situation is that I want to update a couple of 'I'm here' status files
before leaving, pretty much like turning on your answering machine
before you go out I 'spose. What I'd ideally like is to be able to write
something like

+			"&Quit"		  Exec my_shell_script  then Quit

but I can't seem to see any way of doing it. Is it possible, and if not
how about sticking it in the next version, maybe with a syntax like

+			"&Quit"		  command1 ; command2 ; command3

Anyone?

Cheers,
Lee.
-- 
No matter how hard you try, you can't make a baby in much less than
9 months. Trying to speed this up *might* make it slower, but it won't
make it happen any quicker.
[ftp://sunsite.doc.ic.ac.uk/rfc/rfc1925.txt]
--
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: "Fred L. Drake" <[email-masked]>
Date: Fri, 2 May 1997 09:36:01 -0400 (EDT)

> situation is that I want to update a couple of 'I'm here' status files

  Try defining a function named ExitFunction.

  -Fred

--
Fred L. Drake, Jr.
[email-masked]
Corporation for National Research Initiatives
1895 Preston White Drive
Reston, VA    20191-5434

---

From: [email-masked] (David S. Goldberg)
Date: 02 May 1997 10:07:33 -0400

>> The problem I'm having (Or perhaps the request I'm making?) is for
>> some way of getting Fvwm2 to run a script before actually
>> quitting. The situation is that I want to update a couple of 'I'm
>> here' status files

> Fred L Drake suggested:

That was my first reaction too, but running Exec in the ExitFunction
may not work as expected since the Exec'd programs are effectively run
in the background so fvwm may quit before he wants it to.  One
possibility would have the last script run a given X application and
then in the ExitFunction he could Wait for that application's window
before finishing.  Another possibility is to bag ExitFunction (or, use
it for something else, and build and install FvwmCommand or FvwmPipe
(I prefer the former) from the extras directory.  Run the FvwmCommandS
program in Init and Restart functions, then, from the shell script
call "FvwmCommand quit" and let the shell script figure out when to
actually do the quitting.  FWIW, I use this feature to do lots of
funky stuff at startup.  For example, in a shell script that I run
from my initfunction I set a style for Netscape that starts it on Desk
5.  Then I do some funky stuff with xwininfo to detect that the
Netscape window has mapped, reset Netscape's style to start on Desk 3
and do a netscape -remote for the desired URL.  After detecting that
that window has mapped I reset the style to StartsAnyWhere.  In this
fashion I get complete control over fvwm from the shell.  On top of
that, I don't think it's possible to do it in .fvwm2rc because I can't
seem to set a style in a function.

--
Dave Goldberg
Post: The Mitre Corporation\MS B305\202 Burlington Rd.\Bedford, MA 01730
Phone: 617-271-3887
Email: [email-masked]

---

From: Dan Espen <[email-masked]>
Date: Fri, 02 May 1997 10:10:53 -0400

> I currently have the following in the .fvwm2-menu.
...
> +			"&Quit"		  command1 ; command2 ; command3

Here is one untested way:

AddToFunc ImGone "I" Exec my_shell_script
+ "I" Quit

Then put this is the menu:

+ "&Quit" ImGone

--
Dan Espen                                    Phone: (908) 699-5570
[email-masked]
444 Hoes Lane  Room RRC 1C-214
Piscataway, NJ 08854
--
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: "Lance A. Brown" <[email-masked]>
Date: Fri, 02 May 1997 10:29:48 -0400

If you have an .xsession file or .xinitrc file which runs fvwm2 for
you, just put your status update stuff AFTER the call to fvwm2 so that
they run when you quit fvwm2.

--[Lance]

---

From: H}vard Fosseng <[email-masked]>
Date: Fri, 2 May 1997 17:04:01 +0200 (MET DST)

David S. Goldberg writes:

> before finishing.

I've been using this technique for some time:

_______________________________________________________________________________

AddToFunc Terminer
+ I Exec sh -c "rsh tag gnudoit \'\(hf-save-all-and-terminate\)\'; exec xlogo"
+ I Wait xlogo
+ I Quit

AddToMenu Session	Session		Title
+			&Quit		Terminer

_______________________________________________________________________________

I.e. I exec "sh" with a single command line, the last command in which
is "xlogo". Any other X application should work, but something
lightweight seems the best choice here. It's not necessary to have the
final script run the X application itself, you can do that from the
.fvwmrc.

- Håvard Fosseng