Create a drag and drop Dock icon for UNIX apps

Jun 04, '03 08:56:00AM

Contributed by: Anonymous

One thing that has kept me from re-embracing one of my favorite UNIX editor (Nedit) is not being able to drag and drop files from the Finder to an icon in the dock. I was able to do it with BBEdit, but I wanted a way to do it with Nedit. I found a wonderful app called Dropscript that allows you to make a drop app for shell scripts.

Once you download the Dropscript app, you need to create a shell script that will open your UNIX app and pass a file to it. Notice in the code below that if your UNIX app requires X11, you need to have X11 running and you need to export the DISPLAY enviroment varriable.

#!/bin/sh
cd ~;
DISPLAY=:0.0;
export DISPLAY;
PATH=$PATH:/usr/local/bin;
export PATH ;
/sw/bin/nedit -xrm "nedit*text.background: white" "$@"

To impove this code, I would check to see if X11 is running and start it if it wasn't. But I've included X11 in my startup applications, so I didn't need this step. Once you finish with your shell script, drop it on the DropScript app, it will save a new application file in the same directory. You can use that application file in your dock to drag and drop your files onto it.

[robg adds: I haven't tested this one myself.]

Comments (12)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20030603021007833