Subject: FVWM: FAQ? cutbuffer contents in Exec instances

From: George Michaelson <[email-masked]>
Date: Thu, 22 Feb 1996 17:02:30 +1000

Is there a way to achieve Exec clauses or Function/Macros which
take the current contents of the cut buffer or selection as an
argument?

This would permit click-drag selection of arbitrary text eg
an embedded URL in a screen of text, and then firing up
an ftp/netscape instance with it as a command argument...

-George
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
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: Kai Grossjohann <[email-masked]>
Date: 22 Feb 1996 11:43:30 +0100

>>>>> On Thu, 22 Feb 1996 17:02:30 +1000, George Michaelson
>>>>> <[email-masked]> said:

  George> Is there a way to achieve Exec clauses or Function/Macros
  George> which take the current contents of the cut buffer or
  George> selection as an argument?

You can get xcb.  Then, "xcb -p0" will print the contents of the X
cutbuffer.  Obviously, in a shell script "`xcb -p0`" is useful.

Get xcb from your favorite x.org mirror.
        kai
--
Life is hard and then you die.
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
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: <[email-masked]> (Charles Hines)
Date: Thu, 22 Feb 1996 08:55:16 -0500

>>>>> "George" == George Michaelson <[email-masked]> writes:

George> Is there a way to achieve Exec clauses or Function/Macros which
George> take the current contents of the cut buffer or selection as an
George> argument?

George> This would permit click-drag selection of arbitrary text eg
George> an embedded URL in a screen of text, and then firing up
George> an ftp/netscape instance with it as a command argument...

Check out xcb (available from ftp.x.org).  It can be used to pass the
current selection to any program in shell scripts, fvwm Exec
statements, etc.

Chuck

---

From: Stephan Krings <[email-masked]>
Date: Thu, 22 Feb 96 18:27 GMT+0100

Hello,

> an ftp/netscape instance with it as a command argument...

Try xcb. It should be available on 'ftp.x.org' and its mirrors somewhere
along 'contrib/utilities'. It'll allow you to grab the current X selection,
store it and handle it any way you like. Just as an example, I use the
following shell script:

---------------------------------------------------------------------------
#!/bin/sh

xselection=`xcb -S 0;xcb -p 0`

if echo $xselection | grep -q "^\(http\|ftp\|gopher\|telnet\|wais\|file\)://";then
  netscape -remote "openURL($xselection)" &>/dev/null || netscape "$xselection"
elif echo $xselection | grep -q "\w\+@\w\+";then
  gnudoit -q "(mail nil \"$xselection\")" &>/dev/null|| xemacs -eval "(mail nil \"$xselection\")"
else
  tkmanclient -new $xselection
fi
---------------------------------------------------------------------------

This will take the current selection, see if it looks like an URL, an email
address or anything else, and send it to netscape, xemacs mail-mode or
tkman respectively. I have bound this script to a title button via fvwm's
Exec directive.

Regards,

Stephan 

-- 
---------------------------------------
Stephan Krings		Berlin, Germany
      [email-masked]   
---------------------------------------
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
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: "Bob Mende Pie" <[email-masked]>
Date: Thu, 22 Feb 1996 11:34:38 -0800

On Feb 22,  6:27pm, Stephan Krings wrote:
> Subject: Re: FVWM: FAQ? cutbuffer contents in Exec instances
> Hello,
>
> if echo $xselection | grep -q
"^\(http\|ftp\|gopher\|telnet\|wais\|file\)://";then
>   tkmanclient -new $xselection

I do the same thing to invoke script that will invoke a new or a -remote
openURL netscape window.   I did not like to have to call xcb twice (-S n and
-p n), so I patched xcb to allow for this in 1 command execution with the -P n
flag.   I sent diffs to the author, but got no response.   Here are the diffs:

*** xcb.c	Thu Feb 22 11:31:24 1996
--- xcb.c.orig	Wed Nov  9 14:40:59 1994
***************
*** 629,635 ****
  usage()
  {
  	_fprintf(stderr,
! 		"Usage: %s [Xt option] [-l layout] [-n count] [-p|-P|-s|-S
list] [-r count]\n",
  		PGM_NAME);
  	exit(1);
  }
--- 629,635 ----
  usage()
  {
  	_fprintf(stderr,
! 		"Usage: %s [Xt option] [-l layout] [-n count] [-p|-s|-S list]
[-r count]\n",
  		PGM_NAME);
  	exit(1);
  }
***************
*** 835,844 ****
  		dolist(arg, doset, ptr, nb);
  		XtFree(ptr);
  		break;
- 	case 'P':			/* print one or more buffers */
- 		dolist(arg, dogetseln, (char *)0, 0);
- 		dolist(arg, doprint, (char *)0, 0);
- 		break;
  	case 'S':
  		dolist(arg, dogetseln, (char *)0, 0);
  		break;
--- 835,840 ----
***************
*** 922,928 ****
  	 * one is processed.
  	 */
  	for (p = argv + 1; p < argv + argc; p++) {
! 		if (eq(*p,"-p") || eq(*p,"-P") || eq(*p,"-r") || eq(*p,"-s") ||
eq(*p,"-S")) {
  			if (p == argv + argc - 1)
  				usage();

--- 918,924 ----
  	 * one is processed.
  	 */
  	for (p = argv + 1; p < argv + argc; p++) {
! 		if (eq(*p,"-p") || eq(*p,"-r") || eq(*p,"-s") || eq(*p,"-S")) {
  			if (p == argv + argc - 1)
  				usage();

-- 
				      /Bob...			 [email-masked]
				http://reality.sgi.com/mende/