Subject: FVWM: how can I execute a fvwm cmd after a shell cmd ?

From: Srivathsa Rao U <[email-masked]>
Date: Wed, 10 Dec 2003 20:31:44 +0530

Hi,
  I want to read some file which has fvwm commands after some shell command.
This shell command basically to create the fvwm command file.

Here is the one Eg:
DestroyFunc updatePager
AddToFunc updatePager
+ I Exec xterm +sb -geometry 50X30+502+310 -e .fvwm/updatePager
+ I Read .FvwmForm-Pager

    1st command wil create the file .FvwmForm-Pager which has some fvwm 
setting & it takes input from user as well
    2nd command to read the cammands inside .FvwmForm-Pager.

What is happening now :
  It executes 1st command & 2nd one doesnot wait it for 1st command to 
finish , hense failing.

Could you pls. help me to resolve it.

Thanx & Rgds
Srivathsa

-- 
====================================================================
Srivathsa Rao U,   	    	      Email:  [email-masked]
Texas Instruments (India) Ltd         	   : [email-masked]
			              Phone:          +91-80-5099239
====================================================================

--
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: Dan Espen <[email-masked]>
Date: Wed, 10 Dec 2003 11:32:58 -0500

> Could you pls. help me to resolve it.

You could use FvwmCommand.

First start the server:

AddToFunc StartFunction I Module FvwmCommandS

Then at the end of .fvwm/updatePager, add:

FvwmCommand 'Read .FvwmForm-Pager'

-- 
Dan Espen                           E-mail: [email-masked]

---

From: Mikhael Goikhman <[email-masked]>
Date: Wed, 10 Dec 2003 17:31:54 +0000

>  It executes 1st command & 2nd one doesnot wait it for 1st command to 

If this is a fast non-interactive command, then execute it like:

  PipeRead `xterm +sb -geometry 50X30+502+310 -e .fvwm/updatePager >/dev/null`

(do you really need xterm here, maybe "Exec $[FVWM_USERDIR]/updatePager"?)

If this is long or interactive command, then do this:

  DestroyFunc updatePager
  AddToFunc updatePager
  + I Exec xterm -e .fvwm/updatePager; xmessage -g +2000+2000 -class "DummyWindow" ""
  + I Wait DummyWindow
  + I Read .FvwmForm-Pager

Or use the method suggested by Dan.

Regards,
Mikhael.

---

From: Mikhael Goikhman <[email-masked]>
Date: Thu, 11 Dec 2003 08:13:50 +0000

On 11 Dec 2003 10:13:40 +0530, Srivathsa Rao U wrote:
> 
>    Your solution using xmessage looks suitable ,but I don't have xmessage 
>    command installed in my system.

Then use any other application you have, like "xterm -class DummyWindow"
or "gdialog --title DummyWindow --msgbox finished 100 100".

Don't forget to add "All (DummyWindow) Close" after Wait.

> Can't I make "read .." command to wait till "xterm..." job completes.

You don't want to freeze fvwm until xterm completes, this is why you
can't do it using Read or PipeRead, you need Wait, so fvwm is still
functional although it waits in a function.

> Summary:
>    "Read .FvwmForm-Pager" command should wait till xterm is exited. How 
> can I do this.
> 
> Could you pls. provide me some other alternative.

The answer is the same, either use "FvwmCommand" shell command or "Wait"
fvwm command, whichever is more suitable for you.

Regards,
Mikhael.

---

From: Mikhael Goikhman <[email-masked]>
Date: Fri, 12 Dec 2003 01:49:21 +0000

It is very difficult to quote your messages, because you write comments
above your opponent quotes rather than below.

On 11 Dec 2003 19:39:33 +0530, Srivathsa Rao U wrote:
> 
>    I tried below two commands it didnot work. updatePager1 made my 
> system to hang.
> 
> DestroyFunc updatePager1
> AddToFunc updatePager1
> + I PipeRead 'Exec xterm +sb -geometry 50X30+502+310 -e 
> /user/x0000rao/.fvwm/updatePager; echo Read .FvwmForm-Pager'

> > functional although it waits in a function.

Anyway, if this happened and fvwm is freezed in PipeRead, you may still
switch to another virtual terminal (Ctrl-Alt-F2) and kill the process
(xterm) that freezes fvwm.

> DestroyFunc updatePager
> AddToFunc updatePager
> + I Exec gnome-terminal --class "DummyWindow" --transparent --geometry 
> 50X30+502+310 -e /user/x0000rao/.fvwm/updatePager
> + I Wait DummyWindow
> + I All (DummyWindow) Close
> + I Read .FvwmForm-Pager

This is not what I suggested in the original message.
If you reread it again, I suggested the following:

  DestroyFunc updatePager
  AddToFunc updatePager
  + I Exec xterm -e $[FVWM_USERDIR]/updatePager; \
    xterm -g +3000+3000 -class DummyWindow  # put dummy window out of screen
  + I Wait DummyWindow
  + I All (DummyWindow) Close
  + I Read .FvwmForm-Pager

Then fvwm will wait in this function on "Wait", until it sees "DummyWindow"
window, but fvwm still stays functional to manage windows during this wait.

In the same message I also mentioned another simple solution without
creating a dummy window:

  DestroyFunc updatePager
  AddToFunc updatePager
  + I Exec xterm -e $[FVWM_USERDIR]/updatePager; \
    FvwmCommand "Read .FvwmForm-Pager"  # shell runs xterm, then FvwmCommand

  AddToFunc StartFunction
  + I Module FvwmCommandS

"Exec" command forks a shell, you may run as many commands sequentially
in this shell as you want, like: Exec command1; command2; command3.

Regards,
Mikhael.

---

From: Mikhael Goikhman <[email-masked]>
Date: Fri, 12 Dec 2003 06:03:42 +0000

On 12 Dec 2003 11:02:04 +0530, Srivathsa Rao U wrote:
> 
> Is this needs some sort of setting before FvwmCommand execution.

Yes, it is. It is documented in the FvwmCommand man page and was
mentioned by me and Dan that FvwmCommand does not work without
FvwmCommandS module.

> I did only AddToFunc StartFunction I Module FvwmCommandS in
> FvwmForm-Talk. Is this fine ?

No, this line adds something to some function, it does not run anything.

You should put this line into your .fvwm2rc and do Restart.
StartFunction is executed on start and restart.

Or execute "Module FvwmCommandS" in FvwmTalk if you don't want to Restart.

I still don't lose my hope to see your responses in the Netiquette way,
i.e. related-quote-then-corresponding-answer.

Regards,
Mikhael.