delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/11/24/08:35:57

X-Spam-Check-By: sourceware.org
Message-ID: <4385C1B0.662B4DAC@dessent.net>
Date: Thu, 24 Nov 2005 05:35:44 -0800
From: Brian Dessent <brian AT dessent DOT net>
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Fwd: cygwin tools in context menus
References: <a6cc33f0511231356o7c7e5cacm138159ee97875a95 AT mail DOT gmail DOT com> <a6cc33f0511240422l6231c13ex969447648613a72c AT mail DOT gmail DOT com>
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Rupert Brooks wrote:

>  What i would like to do, is be able to right click on a file in
> Windows explorer and have a cygwin tool be avaiable either for the
> open, or the open with command.  I've tried quite a variety of things,
> and i've gotten close... but so far no cigar.  Heres a description of
> what i tried and the problems that result

There are two fundamental problems you're running into here.

First, Explorer will try to provide a windows filename (C:\Documents...)
but gv is a Cygwin application and expects a posix filename
(/cygdrive/c/Documents...).  You should not try to give windows
filenames to Cygwin programs, because if it works you are just lucky. 
This is what the cygpath utility is for.

Second, you need to quote the filename so that it is passed all as one
argument.

Unfortunately combining the two such that you don't get a command prompt
is kind of hard.

The command I started with was:

c:\cygwin\bin\bash -c "/usr/X11R6/bin/gv -display localhost:0.0
\"$(cygpath \"%1\")\""

This works but the bash console window hangs around.  To get around this
you can use "&" to have bash launch the process in the background.  But
it is still "associated" with that console so you have to use the setsid
utility to disassociate it:

c:\cygwin\bin\bash -c "setsid /usr/X11R6/bin/gv -display localhost:0.0
\"$(cygpath \"%1\")\" &"

This works, but you still see the console briefly flash.  You can
further eliminate this by using run to start bash:

C:\cygwin\bin\run bash -c "/usr/X11R6/bin/gv -display localhost:0.0
\"$(cygpath \"%1\")\" &"

This works for me.  I had to use -display as parameter to gv because for
some reason it wasn't finding $DISPLAY in the environment.  I'm not sure
why that is, it might be a bug.  It was easier just to supply it on the
command line though.

Brian

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019