Subject: FVWM: QuitFunction

From: Remko Troncon <[email-masked]>
Date: Tue, 13 Aug 2002 08:29:48 +0200

Hi,

I am using xplanet to update my background every couple of minutes. When
i quit fvwm, i would like to kill xplanet so that it doesn't keep on
running. A QuitFunction (called only when actually quitting) would be
convenient for this, but i can't seem to find it in the manual. Why is
this ?

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

---

From: Mikhael Goikhman <[email-masked]>
Date: Tue, 13 Aug 2002 06:35:41 +0000

> convenient for this, but i can't seem to find it in the manual. Why is

It's named ExitFunction.

Regards,
Mikhael.

---

From: Remko Troncon <[email-masked]>
Date: Tue, 13 Aug 2002 09:00:30 +0200

> It's named ExitFunction.

Yes, i saw the ExitFunction. But the man page says that this function is
called  on restarts  also. I only  want  to kill  xplanet when  actually
quitting.

cheers,
Remko

---

From: Mikhael Goikhman <[email-masked]>
Date: Tue, 13 Aug 2002 07:23:23 +0000

> called  on restarts  also. I only  want  to kill  xplanet when  actually

Well, you may start xplanet in StartFunction instead of InitFunction
and ExitFunction will work for you like you want.

Or run an fvwm wrapper like this:

  xplanet &
  fvwm
  killall xplanet  # or: kill `pidof xplanet`

Regards,
Mikhael.

---

From: Remko Troncon <[email-masked]>
Date: Tue, 13 Aug 2002 09:30:11 +0200

> and ExitFunction will work for you like you want.

That's not really what you would want to do with xplanet.

>   killall xplanet  # or: kill `pidof xplanet`

This is indeed a solution, but i was wondering if it could be moved
inside fvwm. Is there a reason why there is no such QuitFunction ?

cheers,
Remko

---

From: Mikhael Goikhman <[email-masked]>
Date: Tue, 13 Aug 2002 09:23:29 +0000

> That's not really what you would want to do with xplanet.

I don't see a problem with this.

> inside fvwm. Is there a reason why there is no such QuitFunction ?

Noone just needed it, because other solutions exist. We would also need
PreRestartFunction for completeness. And SessionQuitFunction with
SessionPreRestartFunction. When I added StartFunction (to avoid a module
startup duplication) there were some voices saying too many special
functions is not very good. But if there are more people that can't live
without QuitFunction it may be trivially added.

Regards,
Mikhael.

---

From: Remko Troncon <[email-masked]>
Date: Tue, 13 Aug 2002 13:12:01 +0200

> I don't see a problem with this.

It's a pure luxury problem.
When fvwm is restarted, xplanet doesn't have to be restarted because all
it does is update the background. Restarting it on every fvwm restart is
CPU intensive, and causes the background to blank out for a few seconds.

> PreRestartFunction for completeness.

I'm not saying that i _really_ need it, because as you said before, it 
can be moved out of fvwm inside a wrapper. But now that i read the
manual more thoroughly, i get your point on needing Pre-restart
functions. I had the impression that the functions were organized this
way (which they aren't):
    - InitFunction: called upon initialization only
    - QuitFunction (doesn't exist): called when the user quits only

    - StartFunction: called after InitFunction (when initing) or 
                            after RestartFunction (when restarting)
    - RestartFunction: called before QuitFunction (when quitting) or 
                              before StartFunction (when restarting)
My intuition behind this was that, things you want to do before a restart
(RestartFunction) and after a restart (StartFunction) , you also want
to do before quitting and after initing respectively. 

I hope this makes any sense to you at all ;)

cheers,
Remko

---

From: Dominik Vogt <[email-masked]>
Date: Tue, 13 Aug 2002 13:32:19 +0200

> CPU intensive, and causes the background to blank out for a few seconds.

Why don't you just start it in the ~/.xinitrc file?

> I hope this makes any sense to you at all ;)

Bye

Dominik ^_^  ^_^

 --
Dominik Vogt, mail: [email-masked], phone: 0721/91374-382
Schlund + Partner AG, Erbprinzenstr. 4-12, D-76133 Karlsruhe
--
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 [email-masked].
To report problems, send mail to [email-masked].

---

From: Remko Troncon <[email-masked]>
Date: Tue, 13 Aug 2002 13:41:15 +0200

> Why don't you just start it in the ~/.xinitrc file?

That's what i was planning to do. But for some strange reason, i
preferred to have it in my fvwmrc, and have as less as possible inside my 
.xinitrc. (i know, it's a purely subjective principle, but that's just my 
feeling :)

Anyway, i'll stick with the .xinitrc file.

cheers,
Remko

---

From: Mikhael Goikhman <[email-masked]>
Date: Tue, 13 Aug 2002 12:10:28 +0000

> .xinitrc. (i know, it's a purely subjective principle, but that's just my 

My feeling too, .xinitrc is mostly for X settings. Apllications like
background painters are usually a part of a theme, may be different on
different X starts.

Regards,
Mikhael.

---

From: Mikhael Goikhman <[email-masked]>
Date: Tue, 13 Aug 2002 12:19:22 +0000

>                             after RestartFunction (when restarting)

I know 2 reasons for StartFunction to be first and one reason for it to be
second.

>                               before StartFunction (when restarting)

But then RestartFunction would be run twice.

> I hope this makes any sense to you at all ;)

Now when I think about this, I see an elegant solution for these problems.
We only need 2 functions (not including Session*Function variants),
StartFunction and ExitFunction.

StartFunction may include conditions "StartUp" and "Restart", ExitFunction
may include conditions "Restart" and "Quit", these conditions are always
false anywhere else. This way InitFunction and RestartFunction are not
needed (not that RestartFunction is needed now anyway).

  AddToFunc StartFunction
  + I ModuleSynchronous FvwmPerl
  + I On (StartUp) FvwmBanner
  + I On (Restart) Exec play /some/dong.au
  + I FvwmButtons
  + I Exec xterm ...
  + I Wait
  + I Exec mozilla
  + I On (StartUp) Exec xplanet-runner
  + I FvwmPager

  AddToFunc ExitFunction
  + I On (Quit) Exec killall xplanet-runner
  + I On (Restart) Exec play /some/ding.au
  + I Echo "Either Restart or Quit"

I don't know whether it is more intuitive or not.

Regards,
Mikhael.

---

From: Remko Troncon <[email-masked]>
Date: Tue, 13 Aug 2002 15:30:00 +0200

> ...

Your approach is indeed cleaner and more general than what i had in mind.
Another advantage about this is that it's backward compatible.

> I don't know whether it is more intuitive or not.

It is to me !

cheers,
Remko