Subject: FvwmEvent 1.0 (FvwmAudio++) Alpha release

From: Albrecht Kadlec <[email-masked]>
Date: 22 Apr 1998 17:31:02 +0200

New module, full man page at the end:

SYNOPSIS
       FvwmEvent  is  a more versatile replacement for FvwmAudio.
       It can in general be used to hook any  fvwm2  function  or
       program  to any window manager event. e.g: Delete unwanted
       netscape-popups  or  application  error  popups  as   they
       appear, play sounds, log events to a file and the like. Be
       creative, You'll find a use for it.

Could please as many of you as possible test this module with your setup ?

Test version at
<URL:http://www.auto.tuwien.ac.at/~albrecht/fvwm2/FvwmEvent.tgz>

To be released soon (monday ?), after some final fixes & comments.

	Mark Boyns & Mark Scott: are the credits, times & copyrights ok ?
				I included the grant to modify the program
				in the COPYRIGHT section.
				Copyright in code is GPL, just like FvwmAudio.

	Chuck: What do you say ?  Could this replace FvwmAudio after some
	       testing. It's a gerneralization of FvwmAudio.
	
		BTW:	fvwm2 is still lacking an IF and a DELAY
			function. 
			If these functions existed, several ugly race
			conditions could be eliminated:

			   *FvwmEventCmd
			   *FvwmEvent add_window 'Next ["APPL ERROR"] close'

			This sometimes fails to close the newly opened
			window, since the Next is so fast, that it
			sometimes has already evaluated the title of the
			new window, before that title has even been set. 

			Another benefit of a Delay function would be, that
			one could use FvwmEvent to replace simple FvwmAuto.

			   DestroyFunc myfocus
			   AddToFunc myfocus	"I"	Delay 100
						"I"	Raise

			   *FvwmEventCmd
			   *FvwmEvent focus_change	   myfocus

			I'd also find an ALL function very useful.

			e.g:  ALL ["APPL ERROR"] close
			or :  *FvwmEvent add_window 'ALL ["Java Console"] close'

now the full man page:

FvwmEvent(1.0)                                     FvwmEvent(1.0)

NAME
       FvwmEvent - the FVWM Event module

SYNOPSIS
       FvwmEvent  is  a more versatile replacement for FvwmAudio.
       It can in general be used to hook any  fvwm2  function  or
       program  to any window manager event. e.g: Delete unwanted
       netscape-popups  or  application  error  popups  as   they
       appear, play sounds, log events to a file and the like. Be
       creative, You'll find a use for it.

       FvwmEvent is spawned by fvwm2(1), so no command line invo-
       cation   will   work.   From  within  the  .fvwm2rc  file,
       FvwmEvent is spawned as follows:

       Module FvwmEvent

       or from within an fvwm2 pop-up menu:

       DestroyMenu Module-Popup
       AddToMenu Module-Popup "Modules"      Title
       +                      "Event"        Module FvwmEvent
       +                      "Auto"         Module FvwmAuto 200
       +                      "Buttons"      Module FvwmButtons
       +                      "Ident"        Module FvwmIdent
       +                      "Banner"       Module FvwmBanner
       +                      "Pager"        Module FvwmPager 0 3

DESCRIPTION
       The FvwmEvent module communicates with  the  fvwm2  window
       manager to bind actions to window manager events.  Differ-
       ent actions may be assigned  to  distinct  window  manager
       events.

       FvwmEvent  can  be used to bind sound files to events like
       FvwmAudio (RiP) did. It can  be  used  for  logging  event
       traces to a log file, while debugging fvwm2.

       FvwmEvent  can  also  have  builtin  support for the rplay
       library.  (heritage of FvwmAudio)

CONFIGURATION OPTIONS
       FvwmEvent reads the same .fvwm2rc file as fvwm2 reads when
       it starts up, and looks for certain configuration options:

       *FvwmEventCmd command
              This determines the fvwm2 function that  is  to  be
              called  with  the event parameters.  You might want
              to do one of the following (details below):

                   *FvwmEventCmd builtin-rplay
                                  play sounds
                   *FvwmEventCmd /rsynth/say
                                  tell the user, what he did
                   *FvwmEventCmd Echo
                                  echo to fvwm2 stdout
                   *FvwmEventCmd
                                  execute distinct fvwm2 functions
                   *FvwmEventCmd exec
                                  execute distinct external programs

              This version of FvwmEvent has builtin rplay support
              which  does  not  need  to invoke an external audio
              player  to  play  sounds.   The  rplay  support  is
              enabled  when FvwmEvent is compiled with HAVE_RPLAY
              defined (see the Imakefile) and  when  FvwmEventCmd
              is set to builtin-rplay.

              For example:

                   *FvwmEventCmd builtin-rplay
                   *FvwmEvent add_window drip.au

              rplay can be obtained via anonymous ftp at
                   <URL:ftp://ftp.sdsu.edu/pub/rplay>
              or   <URL:ftp://ftp.x.org/contrib/Event/rplay>

              FvwmEvent  also  has support for any other external
              program.  e.g: the rsynth 'say' command:

                   *FvwmEventCmd /rsynth/say
                   *FvwmEvent destroy_window "window closed"

              You can also use fvwm2's builtin  Echo  command  as
              FvwmEventCmd  to  obtain  debug  output  for  fvwm2
              events quietly.  I used this setup  to  debug  Fvw-
              mAuto:

                   *FvwmEventCmd Echo
                   *FvwmEvent focus_change "focus change"
                   *FvwmEvent raise_window "raise window"

              You can even call different shell commands for each
              event just by setting

                   *FvwmEventCmd exec
                   *FvwmEvent add_window killname "APPL ERROR"

       *FvwmEvent window-manager-event action-or-filename
              Binds particular actions to window manager  events.

              e.g. for audio-events:

                   *FvwmEvent startup TaDa.au
                   *FvwmEvent shutdown Elvis_Left.au
                   *FvwmEvent unknown doh.au

                   *FvwmEvent new_page beam_trek.au
                   *FvwmEvent new_desk beam_trek.au
                   *FvwmEvent add_window drip.au
                   *FvwmEvent raise_window swoosh.au
                   *FvwmEvent lower_window swoosh.au
                   *FvwmEvent configure_window hammer.au
                   *FvwmEvent focus_change boing.au
                   *FvwmEvent destroy_window explosion.au
                   *FvwmEvent iconify ploop.au
                   *FvwmEvent deiconify ploop.au
                   *FvwmEvent window_name huh.au
                   *FvwmEvent icon_name beep.au
                   *FvwmEvent res_class beep.au
                   *FvwmEvent res_name beep.au
                   *FvwmEvent end_windowlist twang.au

                   *FvwmEvent icon_location beep.au
                   *FvwmEvent map beep.au
                   *FvwmEvent error beep.au
                   *FvwmEvent config_info beep.au
                   *FvwmEvent end_config_info beep.au
                   *FvwmEvent icon_file beep.au
                   *FvwmEvent default_icon beep.au
                   *FvwmEvent string plapper.au

                   *FvwmEvent mini_icon beep.au
                   *FvwmEvent windowshade beep.au
                   *FvwmEvent dewindowshade beep.au

              Provided  fvwm2  supports  it (not yet), there's an
              additional event to replace all fvwm2 beeps with  a
              sound:

                   *FvwmEvent beep beep.au

              The toggle_paging event will be supported, as soon,
              as it's resurrected by fvwm2:

                   *FvwmEvent toggle_paging fwop.au

       *FvwmEventDelay 5
              Specifies that an event-action will  only  be  exe-
              cuted  if  it  occurs  at least 5 seconds after the
              previous event.  Events that occur during the delay
              period  are  ignored.  This option is useful if you
              don't want several sounds playing at the same time.
              The  default  delay  is  0 which disables the Event
              delay.

RPLAY OPTIONS
       The following options are only valid  with  builtin  rplay
       support.   They  are only valid when FvwmEvent is compiled
       with HAVE_RPLAY defined (see the Imakefile) and  they  are
       used only if FvwmEventCmd is set to builtin-rplay.

       *FvwmEventRplayHost hostname
              Specifies  what host the rplay sounds will play on.
              The hostname can also be  an  environment  variable
              such as $HOSTDISPLAY.

       *FvwmEventRplayPriority 0
              Specifies  what  priority  will  be assigned to the
              rplay sounds when they are played.

       *FvwmEventRplayVolume 127
              Specifies what  volume  will  be  assigned  to  the
              sounds when they are played.

INVOCATION
       The  invocation  method was shown in the synopsis section.
       No command line invocation is possible. FvwmEvent must  be
       invoked by the fvwm2 window manager.

FvwmAudio Compatibility
       FvwmAudioPlayCmd   used   to  call  an  external  program.
       FvwmEventCmd calls an fvwm2  function.  External  programs
       can  be  called  using  the fvwm2 exec function "exec pro-
       gram".

       FvwmAudioDir has been removed due to  the  fact  that  the
       parameters don't have to be files any more.  use:

            DestroyFunc mysay
            AddToFunc mysay "I" exec /rsynth/say /rsynth/audiofiles/$1

            *FvwmEventCmd mysay

BUGS
       It's  REALLY noisy when fvwm2 starts and restarts using an
       audio player.  FvwmEventDelay helps a little bit.

       The parameters inherent to several events are not accessi-
       ble.  This  might be implemented in the future so that the
       command  executed  by  fvwm2   looks   like   FvwmEventCmd
       FvwmEvent-parameters event-specific-parameters.

       Simple FvwmAuto could then be emulated by:
            *FvwmEventCmd
            *FvwmEvent raise-window Raise

COPYRIGHTS
       This  module  has  evolved  of FvwmAudio, which in term is
       heavily based on a similar Fvwm module called FvwmSound by
       Mark  Boyns. FvwmAudio simply took Mark's original program
       and extended it to make it generic enough to work with any
       Audio  player.  Due  to  different requests to do specific
       things on specific events, FvwmEvent took  this  one  step
       further  and  now  calls  any  fvwm2 function, or builtin-
       rplay. If fvwm2's Exec function is used, any external pro-
       gram can be called with any parameter.

       The concept for interfacing this module to the Window Man-
       ager, is original work by Robert Nation.

       Copyright 1998  Albrecht  Kadlec.   Copyright  1994,  Mark
       Boyns and Mark Scott.  No guarantees or warranties or any-
       thing are provided or implied in any way whatsoever.   Use
       this program at your own risk.  Permission to use and mod-
       ify this program for any purpose is given, as long as  the
       copyright is kept intact.

AUTHORS
       1994  FvwmSound  Mark Boyns       ([email-masked])
       1994  FvwmAudio  Mark Scott       ([email-masked])
       1996  FvwmAudio  Albrecht Kadlec
       1998  FvwmEvent  Albrecht Kadlec  ([email-masked])

                           Apr 22 1998                          5

-- 
Albrecht Kadlec
---------------
It may be legendary but the swordmakers of ancient times were said to
have quenched red hot blades by running them through the bodies of
slaves, which would certainly both raise the temper of the slaves and
also most likely quench them as well.	
			-- Alan Heldman about "tempering & quenching steel"
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked].

---

From: "Charles Hines" <[email-masked]>
Date: Wed, 22 Apr 1998 13:26:55 -0400 (EDT)

>>>>> "A" == Albrecht Kadlec <[email-masked]> writes:

A> New module, full man page at the end:

A> SYNOPSIS
A>        FvwmEvent  is  a more versatile replacement for FvwmAudio.
A>        It can in general be used to hook any  fvwm2  function  or
A>        program  to any window manager event. e.g: Delete unwanted
A>        netscape-popups  or  application  error  popups  as   they
A>        appear, play sounds, log events to a file and the like. Be
A>        creative, You'll find a use for it.

Hm.  Sounds good.

A> Could please as many of you as possible test this module with your setup ?

A> Test version at
A> <URL:http://www.auto.tuwien.ac.at/~albrecht/fvwm2/FvwmEvent.tgz>

A> To be released soon (monday ?), after some final fixes & comments.

A>      Mark Boyns & Mark Scott: are the credits, times & copyrights ok ?
A>                              I included the grant to modify the program
A>                              in the COPYRIGHT section.
A>                              Copyright in code is GPL, just like FvwmAudio.

You know, the fact that FvwmAudio is GPLed has bothered me slightly
since the rest of the stuff distributed in fvwm follows the twm/fvwm
copyright.  I suppose it doesn't really matter though (any kind of
leagalese makes me nervous).

A>      Chuck: What do you say ?  Could this replace FvwmAudio after some
A>             testing. It's a gerneralization of FvwmAudio.

I haven't looked too closely at it yet, but at first glance I don't
see why not.  Could probably replace FvwmAuto too, as you noted.

A>              BTW:    fvwm2 is still lacking an IF and a DELAY
A>                      function.

I had already planned on putting something like a 'Sleep' function in
2.0.47 that works like 'Wait' but just does a timeout instead of
waiting for a window to appear.  You know, a 'WaitWithTimeout' might
not be a bad idea either...

As for an 'If' function, that might be useful for things that aren't
easily handled by Next/Prev/Current/None/WindowId.  Something like:

  If [conditional] true_action false_action

looks simple at first glance, but I think actually implementing the
'conditional' part might not be so simple.  What types of condition
checks (that can't be handled by Next/Prev/etc) does everyone think
would be handy?

A>                      If these functions existed, several ugly race
A>                      conditions could be eliminated:

A>                         *FvwmEventCmd
A>                         *FvwmEvent add_window 'Next ["APPL ERROR"] close'

A>                      This sometimes fails to close the newly opened
A>                      window, since the Next is so fast, that it
A>                      sometimes has already evaluated the title of the
A>                      new window, before that title has even been set.

A>                      Another benefit of a Delay function would be, that
A>                      one could use FvwmEvent to replace simple FvwmAuto.

A>                         DestroyFunc myfocus
A>                         AddToFunc myfocus    "I"     Delay 100
A>                                              "I"     Raise

A>                         *FvwmEventCmd
A>                         *FvwmEvent focus_change         myfocus

A>                      I'd also find an ALL function very useful.

A>                      e.g:  ALL ["APPL ERROR"] close
A>                      or :  *FvwmEvent add_window 'ALL ["Java Console"] close'

Yup, 'All' should probably be added to that Next/Prev/etc list above
and shouldn't be too hard to implement.  I'll put in on my list for
2.0.47.

Chuck

--
*******************************************************************************
Charles K. Hines <[email-masked]>
IBM Logic Synthesis Developer [BooleDozer (TM)]
Martial Arts Instructor [Modern Arnis, Presas Style Filipino Martial Arts]

         "Go back to sleep, Chuck.  You're just havin' a nightmare
             -- of course, we ARE still in Hell." (Gary Larson)
*******************************************************************************
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Albrecht Kadlec <[email-masked]>
Date: 27 Apr 1998 12:16:44 +0200

> A>        creative, You'll find a use for it.

great.

> A>                              Copyright in code is GPL, just like FvwmAudio.

Mark Boyns > Seems ok with me.  I haven't been using fvwm lately but I'll try to
Mark Boyns > get around to looking at it someday.  I'll be happy just as long as
Mark Boyns > there's builtin support for rplay.

For my part, I'd like to move the rplay function out of FvwmEvent (!?) into
Fvwm core, so that anyone could use the new function >builtin-rplay "file"<
(only included, if fvwm2 is compiled with --HAVE_RPLAY)

> leagalese makes me nervous).

me too: it's "my Contribution to Free Software" as my homepage says.
in the way "Do whatever you want to", use code or code-snippets / idea.

I don't like the idea that someone could sell Free Software. But I can't do
anything against it.

... except maybe Microsoft: they must not use idea and/or code for any
purpose - hmmm, I might add that to the copyright section :-)
or only if they use the --with-all-bugs or --coredump-once-per-hour
compilerswitch.

> see why not.  Could probably replace FvwmAuto too, as you noted.

FvwmAuto does some more things, but with some slight extensions to Fvwm
functions, we could come pretty near.

> checks (that can't be handled by Next/Prev/etc) does everyone think

I too think that a complete boolean eval is not simple and only used for
this single function, while extending the next conditions would make many
new things possible, we can't think of now.
Every item you add to the condition, you can use for prev/next/none/all/if.

Some combinations may be cryptic, but what is

DestroyFunc Do
AddToFunc Do		"I"	$0 $1 $2 $3 $4 $5 $6 $7 $8 $9

*FvwmAudioPlayCmd Do
*FvwmAudio add_window	   'Next ["APPL ERROR"] close'

Module FvwmAudio

which led me to renaming FvwmAudio.

BTW:
I still miss the WindowId as part of the prev/next/none clause.

"next [windowid $w iconic] do_sth" is the kind of conditional I most often
need. 
(e.g: for FvwmAuto, if the window has been closed within the timeout.)

and some sort of GetWindowId would be nice for the delay:

DestroyFunc destroy_after_timeout
AddToFunc destroy_after_timeout "I" delay 100
				"I" destroy $1

destroy_after_timeout GetWindowId

otherwise the wrong window would be closed.

another idea would be variables, to have some old state-info after a delay.

	"I"	$a=WindowID
	"I"	delay 100
	"I"	close $a
	
and, and, ....

and some hundred programmers on the net to implement it. ;^)
 
-- 
Albrecht Kadlec
---------------
The most horrifying thing about Unix is that, no matter how many times
you hit yourself over the head with it, you never quite manage to lose
consciousness.  It just goes on and on.      -- Patrick Sobalvarro
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked].