This is the mail archive of the
cygwin-apps
mailing list for the Cygwin project.
Proposal for associating file extensions with cygwin programs
- From: Dave <kilroyd at googlemail dot com>
- To: cygwin-apps at cygwin dot com
- Date: Sun, 21 May 2006 18:19:00 +0100
- Subject: Proposal for associating file extensions with cygwin programs
As I stated here:
http://cygwin.com/ml/cygwin/2006-02/msg00591.html
In response to a few requests (two that I am aware of):
http://cygwin.com/ml/cygwin/2006-02/msg00533.html
http://cygwin.com/ml/cygwin/2005-11/msg00738.html
and my original proposal:
http://cygwin.com/ml/cygwin-apps/2005-11/msg00274.html
I've done a little work on a script and small application allowing users
to set up some explorer integration for cygwin applications, using
script fragments that would be installed with the packages (and
maintained by the application package maintainers).
I'm looking for feedback on what I've done so far. Eventually I'll
either ITP this as a new package, or merge the functionality with chere.
(Or if no interest, just drop it entirely). Everything works for me as
it stands (W2K Prof).
Details below for those who are interested.
Dave.
Source and examples available at:
http://www.virtualsoup.org/files/sentry-0.1-1.tar.bz2
* Instructions
1. Extract somewhere
2. Run configure and make (package isn't autoconfed, but should behave
well enough). Note the standard cygwin make 3.80 won't succeed. It needs
3.81 or the patch at
http://savannah.gnu.org/bugs/?func=detailitem&item_id=1517
3. Do make install, or just place sentry.exe in your path.
4. Play with the xpintegrate script (in whereever you extracted things to)
* Details
The xpintegrate script is like the chere script. It is modular and does
not contain the specific code for shell/terminal stuff. It is intended
to setup handlers for particular file extensions as defined by shell
fragments (in the examples directory). Use the -h option to get help.
Before having the script do anything (-i/-u), please use the -p option
and check what it will do to the registry.
Starting cygwin programs requires that any file arguments are POSIX
style, and that the environment is setup as from a login shell. This
could be done by starting a login shell for each program and running a
script to convert the filenames. After investigating it seems more
efficient to have a common login shell spawn subsequent programs.
sentry.exe is a mingw tray icon application. Upon startup it starts a
login shell (default ash) with stdin, stdout and stderr redirected to
pipes controlled by sentry.exe.
Each subsequent instance of sentry.exe passes its command line arguments
to the original instance and exits.
The original instance parses the command line arguments and executes
them in the login shell. It optionally passes certain arguments through
cygpath.
When started right-clicking the cygwin icon and selecting Console will
let you see the commands being executed, and any command output (or errors).
** Known issues
- if bash is used as the login shell a command isn't executed until
another command is received.
http://cygwin.com/ml/cygwin/2006-04/msg00980.html
* Shell fragments
The shell fragments which define how to setup things for a given
application have the extension .xpi. I've included whatever I thought
might be useful, but only a some of the information is used at the
moment to setup the context menus.
Suggestions on other infomation to put there welcome.
** Examples
I've put together examples to associate .txt files with notepad, .exe
files with insight, and Drives/Directories with a login and non-login
rxvt/bash.
The bash examples are merely to show that it can be done, and to
highlight any differences in environment. I'm not sure whether we should
use this mechanism to subsume chere functionality. It's messy enough as
it is.
I don't use the xserver, but it should be simple enough to set up .xpi
files for any X program.
WARNING: Avoid associating an app with .exe. I did this with my first
attempt for insight. It breaks Start...run (and who knows what else).
Associate with exefile instead. I need to verify that using exefile
works on all windows versions though.
* TODO
- Decide where to put .xpi files
- Add ability to copy text from console dialog
- Read login shell to use settings from /etc/passwd by default
- Add a properties dialog to allow the user to specify that sentry use
a particular login shell.
- ... other options???
* License
The code is GPL'ed.