


XDROP(1)                                                 XDROP(1)


NNAAMMEE
       xdrop - drag/drop or select/paste application launcher

SSYYNNOOPPSSIISS
       xxddrroopp [ _s_t_a_n_d_a_r_d _X_v_i_e_w _c_o_m_m_a_n_d _l_i_n_e _a_r_g_u_m_e_n_t_s ] [ --ii <icon
       file> ] [ --xx <xbm file> ] [ --ll <icon label> ] <command>

DDEESSCCRRIIPPTTIIOONN
       xxddrroopp is an Open Look utility  that  allows  users  invoke
       normal  UNIX  applications by pasting text or by using the
       Open Look drag and drop mechanism.

       When xdrop is running it displays an  icon  in  a  window.
       The user can drag and drop files or text onto the icon and
       xdrop will run <<ccoommmmaanndd>> which may use the files  or  text
       in its arguments.

       Additionally,  the  user may click the middle mouse button
       over the icon and xdrop will execute the command using the
       current primary selection as text.

       While  the  command  is  being executed, xdrop inverts the
       icon. The command that is executed  can  be  edited  while
       xdrop  is running by selecting the icon (usually by click-
       ing the left mouse button).

       The  command  is  passed  to  the  system  shell  (usually
       /bin/sh)  to  be  executed.  The two environment variables
       FFIILLEE and TTEEXXTT are available to the command and their  val-
       ues  depend on the user action that initiated the command.


       -      When a file  is  dragged  from  another  Open  Look
              application  (for example, filemgr) $$FFIILLEE is set to
              the full path and filename of the file and $$TTEEXXTT is
              set to the contents of the file.


       -      When  text is dragged from another Open Look appli-
              cation (for example, cmdtool) $$FFIILLEE is not  defined
              and $$TTEEXXTT is set to the text.


       -      When text is pasted from another X application (for
              example, xterm) $$FFIILLEE is not defined and  $$TTEEXXTT  is
              set to the text.


OOPPTTIIOONNSS
       --ii     specifies a Sun icon file to use for the icon, per-
              haps created by iconedit.


       --xx     specifies an X11 bitmap file to use for  the  icon,



                         14 December 1990                       1





XDROP(1)                                                 XDROP(1)


              perhaps created by bitmap or xpaint.


       --ll     specifies  a label that will be displayed below the
              icon.


NNOOTTEESS
       When invoking xdrop, it is important to enclose the  <<ccoomm--
       mmaanndd>>  argument  in single quotes to prevent references to
       $FILE and $TEXT being expanded by the shell on the command
       line. Also, if you want to be able to invoke several inde-
       pendent applications from xdrop, remember to add a  trail-
       ing && to the command to execute it in the background.

       If  no icon is specified, xdrop uses a default xdrop icon.

       When the xdrop application is closed you  can  still  drag
       and  drop  files  and  text  onto its icon, but you cannot
       paste text using the middle mouse button.  Note  that  the
       closed xdrop icon may take up more room on the screen than
       the open application.

       The command executed by xdrop has the same working  direc-
       tory  as  the xdrop program itself. Sometimes you may wish
       to change directory in the command line you give to xdrop.
       See the xxtteerrmmddrroopp example below for an example.

       I  prefer  xdrop  windows to have no titlebar. You have to
       tell your window manager to do this. For  olwm  and  olvwm
       you add this line to .Xdefaults,

       OOppeennWWiinnddoowwss..MMiinniimmaallDDeeccoorr:: xxddrroopp

       For twm you add this line to .twmrc

       NNooTTiittllee{{""xxddrroopp""}}


EEXXAAMMPPLLEESS
       The  supplied  examples  are shell scripts and they assume
       that the icons are in a directory ~/xdrop.

       xxddrroopp --xx mmaann3322..xxbbmm ''xxtteerrmm --ee mmaann $$TTEEXXTT &&''

       This simple example looks up one or more  man  pages  when
       command  or  function names are dropped or pasted into it.
       This is included as the script mmaannddrroopp in the  xdrop  dis-
       tribution.

       xxddrroopp --ii eeddiitt..iiccoonn ''ccdd ;; xxtteerrmm --ee vvii $${{FFIILLEE::--$$TTEEXXTT}} &&''

       This  simple  example  edits  one  or  more files that are
       dropped onto it. If text is pasted into it  then  FFIILLEE  is



                         14 December 1990                       2





XDROP(1)                                                 XDROP(1)


       undefined,  so  it  uses $$TTEEXXTT as filenames. Dropped file-
       names are always absolute but pasted text will be a  rela-
       tive  filename unless it starts with a slash. In this case
       the filename is relative to the working driectory  of  the
       xdrop  program itself, so this example changes to the home
       directory first.  This is included as the script  eeddiittddrroopp
       in the xdrop distribution.

       xxddrroopp --xx xxtteerrmm..xxbbmm --ll ''xxtteerrmm'' ''ccdd ;; xxtteerrmm --ssbb &&''

       This  example  shows  how xdrop can be used just to launch
       applications.  Clicking the middle  mouse  button  on  the
       icon  creates  new xterm windows.  Note that it changes to
       the home directory first.  This is included as the  script
       xxtteerrmmddrroopp in the xdrop distribution.

       xxddrroopp  --xx ssppeellll3322..xxbbmm ''eecchhoo $$TTEEXXTT || iissppeellll --ll >> //ttmmpp//ssppeellll
       ;; xxtteerrmm --ee lleessss //ttmmpp//ssppeellll ;; rrmm //ttmmpp//ssppeellll''

       This example displays spelling errors in some  text  or  a
       file  that  is  dropped  onto it.  This is included as the
       script ssppeellllddrroopp in the xdrop distribution.


RREEQQUUIIRREEMMEENNTTSS
       Xdrop requires the xview toolkit version 3.0 or later  and
       an ANSI C compiler to compile.

       Drag and drop should work with OpenWindows 3 applications,
       but not OpenWindows 2 applications.

       I have no idea about OpenWindows 4 or  Solaris  or  X11R6.
       This functionality is the least tested.

       Pasting text should work from most X11 applications (Xt or
       Xview based).

       Xdrop does not require OpenWindows or an Open Look  window
       manager  to run. You can just use it with xterm and twm if
       you like.


HHOOWW IITT WWOORRKKSS
       Whether you drag and drop or select and paste, xdrop  ends
       up getting the value of the current primary selection. The
       selection is usually available as several different target
       types.  You ask for the type you want and the owner of the
       selection provides it.

       The targets can be different representations of the selec-
       tion  itself or information about the selection. For exam-
       ple, with a dropped file you can  get  the  filename,  the
       contents  of  the  file or the length of the file. You can
       see the available targets by running xdrop with the --ddeebbuugg



                         14 December 1990                       3





XDROP(1)                                                 XDROP(1)


       option. Xdrop uses the STRING and FILE_NAME targets.

       Once  xdrop has the selection it constructs a command line
       to pass to the shell. This has up to three components -  a
       filename,  some  text and the command to execute. If there
       is   a   filename   then   the   command   line   contains
       FFIILLEE==""ffiilleennaammee""  ;;  eexxppoorrtt FFIILLEE ;; to set up the FFIILLEE vari-
       able. There is a similar construct  to  set  up  the  TTEEXXTT
       variable. The last part of the command line is the command
       to execute, which can refer to  $$FFIILLEE  and  $$TTEEXXTT  in  its
       arguments.

       There  are some considerations about quoting. The value of
       TTEEXXTT needs to be quoted to allow white  space  within  it.
       Single quotes are no good because there is no way to get a
       single quote (ie an apostrophe) within them.  With  double
       quotes,  the shell expands expressions containing the spe-
       cial characters backquote, dollar and backslash.

       Xdrop assumes that the selection will be literal text,  so
       it  escapes  each of the special characters and any double
       quotes with a backslash.  You can see the results of  this
       processing by running xdrop with the --ddeebbuugg option.

       Newlines are also special and appear differently depending
       on how you refer to a variable. For example eecchhoo $$TTEEXXTT and
       eecchhoo ""$$TTEEXXTT"" work differently.


BBUUGGSS
       If  there  is  no  selection  when you paste, it sometimes
       takes a while for the selection mechanism to realise there
       is  nothing selected. It gets there after a few seconds. I
       think this is happening in the xview toolkit  rather  than
       in the X server.

       Xdrop  uses ssyysstteemm(()) to execute the command. This seems to
       work alright but the book says its bad.

       If you find xdrop does not work as expected with drag  and
       drop from a particular application, try the --ddeebbuugg option.
       This will display the types of  selection  available  from
       the   source   application.  xdrop  uses  the  STRING  and
       FILE_NAME targets.

       It can be very difficult to  think  about  xterms  running
       shells  expanding  command  lines  with  several levels of
       quoting involved.


HHIISSTTOORRYY
       Xdrop was originally written in 1990, back when  drag  and
       drop  was new to the xview toolkit. It was released to the
       net but it didn't change  the  world  :)  It  wasn't  long



                         14 December 1990                       4





XDROP(1)                                                 XDROP(1)


       before  Sun  released  xview 3.0 and OpenWindows 3.0 which
       meant that xdrop didn't work any more...

       After a long while and some enquiries from poeple I ported
       it  to  xview  3.0 so that it would work with the new drag
       and drop mechanism. I also  added  the  pasting  mechanism
       since  this  allowed  it  to work easily with Xt apps too.
       This is how I use xdrop at the moment (no  OpenWindows  at
       home).

       There  was  another  pause in development as I watched the
       future of xview hanging in the balance. It's  still  hang-
       ing,  so  I  decided to release version 2 anyway. I wonder
       how long it will last...


AAUUTTHHOORR
       The author of xdrop is Mark  Dobie  (mrd@ecs.soton.ac.uk).
       Please mail me if you have any problems or if you have any
       ideas about useful additions to xdrop.


AACCKKNNOOWWLLEEDDGGEEMMEENNTTSS
       Thanks to William R White III for some testing.

       I would like to thank Joan Cragun for  kindly  telling  me
       how to read an icon into the program.

       Xdrop version 2 was developed using freely available soft-
       ware.

       Thanks to Linus Torvalds, Peter Macdonald, all  the  other
       contributors  to Linux, The XFree86 Project and the X Con-
       sortium, Steve Kirkendall, Jef Poskanzer, the  Free  Soft-
       ware Foundation and Sun Microsystems.






















                         14 December 1990                       5


