Re: FVWM: FAQ? cutbuffer contents in Exec instances

From: Bob Mende Pie <mende_at_piecomputer.corp.sgi.com>
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,
>
> > 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...
>
> 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\+_at_\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.

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...			 mende_at_sgi.com
				http://reality.sgi.com/mende/
--
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 majordomo_at_hpc.uh.edu.
To report problems, send mail to fvwm-owner_at_hpc.uh.edu.
Received on Thu Feb 22 1996 - 13:35:00 GMT

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:37:58 BST