Proposal for associating file extensions with cygwin programs
Sun May 21 17:19:00 GMT 2006
As I stated here:
In response to a few requests (two that I am aware of):
and my original proposal:
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.
Source and examples available at:
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
3. Do make install, or just place sentry.exe in your path.
4. Play with the xpintegrate script (in whereever you extracted things to)
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
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.
* 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.
I've put together examples to associate .txt files with notepad, .exe
files with insight, and Drives/Directories with a login and non-login
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
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.
- 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???
The code is GPL'ed.
More information about the Cygwin-apps