Mail Archives: cygwin/2005/11/24/08:35:57
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 -