Subject: FVWM: function question

From: "Stephen P. Hill" <[email-masked]>
Date: Tue, 28 Sep 1999 00:19:48 +0000

All:

I recently saw a question and several answers on this mailing 
list that inspired me to finally play with functions and FvwmButtons 
a little more.  I don't see how to implement what I want to do, 
though, and any advice would be appreciated.  

I am using fvwm 2.2.2 with FvwmCPP on Solaris and/or Linux, and 
although I don't use Netscape to read my E-mail many people 
using my fvwm2rc file do.  I want to provide a Netscape button 
in FvwmButtons that does three jobs:

	Mouse button 1: focus or start netscape

	Mouse button 2: iconize or de-iconize netscape

	Mouse button 3: 
		if( there is a "MailThread" window ) then
			focus it
		else
			if( there is a Netscape window ) then
				# have it open a MailThread
				netscape -remote 'openInbox'
			else
				# start a new NS process in mail
				netscape -mail
			endif;
		endif;

Buttons 1 and 2 were easy, thanks to the information on the 
mailing list last week.  

This is for button 1:
	AddToFunc "StartOrFocusNetscape"
	+ I None (Netscape*) exec netscape -install
	+ I Next (Netscape) Iconify -1
	+ I Next (Netscape) Focus

Button 2 just does:
	'Prev (Netscape) Iconify toggle'

Button 3 is too complicated and I don't see that there is any syntax 
that will handle it.  If you could combine conditions then it 
could look similar to the following:
  AddToFunc NSMailFunction
  + "I" Next (MailThread) Iconify -1
  + "I" Next (MailThread) focus
  + "I" None (MailThread) Next(Netscape) Exec exec netscape -remote 'openInbox'
  + "I" None (MailThread) None(Netscape) Exec exec netscape -mail

of course, that is not valid syntax.  Is there some other way 
to do this?  I didn't see it in the manpages or FAQ.  Thanks 
in advance for any help.  

-----
Stephen P. Hill
[email-masked]

--
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: Tim Phipps <[email-masked]>
Date: Tue, 28 Sep 1999 15:15:18 +0100

"Stephen P. Hill" wrote:
> of course, that is not valid syntax.

Actually it is valid syntax (you might need a space between the next and
the "(" though) and it does work. Here's my functions for controlling
netscape. Note that netscape is not very good at handling mutiple remote
commands and sometimes loses them.

DestroyFunc my_netscape
AddToFunc my_netscape   I Next (Netscape) Exec netscape -noraise -remote
openBrowser
+                       I None (Netscape) Exec target netscape
+                       I None (Netscape) Wait Netscape
+                       I Next (CurrentDesk Netscape) my_flipfocus

DestroyFunc my_url
AddToFunc my_url        I Next (Netscape) Next (Navigator) Exec netscape
-noraise -remote "openURL($0, new-window)"
+                       I Next (Netscape) None (Navigator) Exec netscape
-noraise -remote "openURL($0)"
+                       I None (Netscape) Exec target netscape $0
+                       I Wait Netscape
+                       I Next (CurrentDesk Netscape) my_flipfocus

DestroyFunc my_mailbox
AddToFunc my_mailbox    I None (MailThread) Next (Netscape) Exec
netscape -noraise -remote openInbox
+                       I None (MailThread) Next (Netscape) Wait
MailThread
+                       I Next (Netscape) Exec netscape -noraise -remote
"openURL($0)"
+                       I None (Netscape) Exec target netscape $0
+                       I None (MailThread) Wait MailThread
+                       I None (CurrentDesk MailThread) Next
(MailThread) MoveToDesk 0
+                       I Next (MailThread) my_flipfocus

DestroyFunc my_mail
AddToFunc my_mail       I my_mailbox IMAP://mailhost/Inbox

Cheers,
Tim.

---

From: Dominik Vogt <[email-masked]>
Date: Tue, 28 Sep 1999 12:45:52 +0200

> of course, that is not valid syntax.

Of course that *is* valid syntax. It doesn't work because you forgot
a whitespace between the 'Next' and the '(Netscape)':

AddToFunc NSMailFunction
+ "I" Next (MailThread) Iconify -1
+ "I" Next (MailThread) focus
+ "I" None (MailThread) Next (Netscape) Exec exec netscape -remote 'openInbox'
+ "I" None (MailThread) None (Netscape) Exec exec netscape -mail
                           ^^^

I've tried it and it works (current development code).

The Next/None/Prev/... commands simply interpret everything after the
condition as a new command.  It doesn't matter at all if this is another
contidional command or something else.  However the first token of the
following text is a command name and must hence be separated from its
parameters with whitespace.

Bye

Dominik ^_^

-- 
Dominik Vogt, Hewlett-Packard GmbH, Dept. BVS
Herrenberger Str.130, 71034 Boeblingen, Germany
phone: 07031/14-4596, fax: 07031/14-3883, [email-masked]
--
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].