[TAG] FVWM

Thomas Adam thomas at edulinux.homeunix.org
Fri Apr 21 21:29:06 MSD 2006


[Cc'ing to TAG in the hopes that (when it gets processed) some people
find this of use, as before in previous exchanges with Vin]

On Wed, Apr 19, 2006 at 03:06:38PM -0700, vsesto at adelphia.net wrote:
> Is there a way to ensure that FvwmCommand is synchronous in it's
> execution?

No.  It communicates via FIFO.  If you want synchonisation, then you
will need to use PipeRead, which effectively blocks until the PipeRead
statement is ended.

Some modules in FVWM adhere to using (when you tell it) the
'ModuleSynchonous' command which does what you expect it would.

> Say I have a function named StartMozilla in the .fvwm2rc file which   
> performs the following actions:                                       
>
> Exec exec mozilla -P test 
> Wait Mozilla 
> Next (Mozilla) MoveToDesk 0 2
>
> then I invoke this function either from a script or a C program as
> follows ...
>
> FvwmCommand 'StartMozilla'
>
> I would like to NOT proceed in the program/script until I know for    
> sure the Function has carried out it's tasks. Seems like FvwmCommand  

Well, by the function's definition as you have it above, that *will*
synchronise.  That's what the ''wait'' command does.

> returns immediately and I am issuing a system command to invoke it    
> which by nature is synchronous. If I were to fork/exec then I could   
> understand that the program would proceed since it's forked, but I    
> was wondering how could what I am trying to do be achieved.           

You would have to use PipeRead from within your function if you want it
synchronous.  Hence:

```
DestroyFunc StartMozilla
AddToFunc   StartMozilla
+ I PipeRead `echo 'Exec exec mozilla -P test' && echo 'Wait Mozilla' &&
  echo 'Next (Mozilla) MoveToDesk 0 2`
'''

This will ensure that the entire lot is synchronous.

> I was thinking along the lines of making the function a               
> ModuleSynchronous versus a straight Module. Would that be the answer? 

You can't make a function synchronous.

> Or is there some way to invoke to do this sort of thing?              

See above.

> Also, how does one ever know if the FvwmCommand took? What I mean     
> is what if I had a "Style" command that determined which desktop to   
> start a window ...                                                    
>
> FvwmCommand 'Style Mozilla StartsOnDesk 2, SkipMapping
>
> then I immediately issue
>
> FvwmCommand 'StartMozilla'
>
> If FvwmCommand returns immediately how would I know if FVWM got the   
> Style command prior to issuing the Mozilla exec? This is another      
> reason for it to be synchronous ...                                   

Well, it just will.  Note that where you want compound statements you
can do:

```
(echo "Style Mozilla StartsOnDesk 2, SkipMapping"; echo "StartMozila") \
| FvwmCommand -c
'''

Although the use of ''StartMozilla'' here (having declared it to start
on Desk 2) is superfluous.

HTH,

-- Thomas Adam

--  
I've been too honest with myself, I should have lied like everybody else.





More information about the TAG mailing list