Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Create a drag and drop Dock icon for UNIX apps UNIX

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.]
    •    
  • Currently 2.25 / 5
  You rated: 4 / 5 (4 votes cast)
 
[10,553 views]  

Create a drag and drop Dock icon for UNIX apps | 12 comments | Create New Account
Click here to return to the 'Create a drag and drop Dock icon for UNIX apps' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Create a drag and drop Dock icon for UNIX apps
Authored by: tandemrepeat on Jun 04, '03 10:40:49AM
Great hint...does exactly as advertised...good stuff...

[ Reply to This | # ]
To start X11
Authored by: rselph on Jun 04, '03 11:04:36AM

The easy way to make sure X11 is running is to put:

open /Applications/X11.app

early in the script. If X11 is already running, this just brings it to the front. Otherwise, it starts it up.

Of course, this assumes that you are using Apples X11 implementation.



[ Reply to This | # ]
Create a drag and drop Dock icon for UNIX apps
Authored by: KOHb on Jun 05, '03 01:53:16AM
See the hint Associate X11 applications with filename extensions from Fri May 16 for more scripts and discussion

[ Reply to This | # ]
Create a drag and drop Dock icon for UNIX apps
Authored by: krsoere on Jun 05, '03 03:24:04AM

Could someone please try to explain to me how to install nedit on my ibook running 10.2.6 and apples X11.
Thanks,
Kristian



[ Reply to This | # ]
Create a drag and drop Dock icon for UNIX apps
Authored by: pdowling on Jun 05, '03 09:18:43AM
You can get version 5.2 from Marc Liyanage. He also has a lot of other software pre complied for OS X.

I've tried to compile from source but need a makefile for Apple's X11 Implementation. Does anyone have one? I'd rather not spent the time creating one if the work has been done.

[ Reply to This | # ]

Create a drag and drop Dock icon for UNIX apps
Authored by: jasont on Jun 05, '03 05:31:37PM

Almost anytime you see something installed in /sw it means it was installed using fink from http://fink.sourceforge.net or a patch that migrated to or from the fink system. It's easy to use and allows you to install most unix apps into an OS X system w/o problems. You can install nedit using fink.



[ Reply to This | # ]
Drop PDF's on joinPDF using DropScript
Authored by: patrickoehlinger on Jun 05, '03 05:11:25AM
Create a drag and drop Dock icon for UNIX apps
Authored by: Karinms on Jun 05, '03 05:47:04AM

I modified this dropscript to be used in opening postscript files and it works great to drag&drop the file. I was just wondering if there was a way to change this so that clicking the file would open it. I don't know much about this, so any advice would be appreciated.

Thanks,
Karin



[ Reply to This | # ]
Create a drag and drop Dock icon for UNIX apps
Authored by: surgenet on Jun 06, '03 01:44:40AM

The line:

DISPLAY=:0.0;
export DISPLAY;

helped fix a problem with a X11 / Cocoa program I'm writing.
Great hint!



[ Reply to This | # ]
Shareware app to launch shell scripts from the finder
Authored by: andyabides on Jun 20, '03 04:48:30AM

I really wanted a way to launch shell scripts with the extension .sh directly from the Finder, but I couldn't find an app that would do this, so I wrote one myself. If you're interested, it's called Shellsilver and it's at http://www.stanford.edu/~andyszy/software/shellsilver.html. It lets you launch shell scripts by double-clicking them.



[ Reply to This | # ]
Shareware app to launch shell scripts from the finder
Authored by: Gigacorpse on Jun 20, '03 08:32:24AM

You can add a .command to a shell script, chmod it to executable, and it will run when doubleclicked.



[ Reply to This | # ]
10.2.8 broke dropscripts:-(
Authored by: airdrummer on Sep 25, '03 10:32:04PM

i made a d.s 4 openoffice (the end of microserfdom!-) which worked great...until now:-( i'd mapped the m$ extensions to the d.s., but it started giving errors, so i regenned it, assuming 10.2.8 had something new...

unfortunately, it has a lot new:-( from the console:

salogl.cxx/GetOGLFnc(): Could not load symbol glFlush
dyld: /Volumes/blueberryUsers/apps/OpenOffice/program/soffice.bin Undefined symbols:
OpenGL undefined reference to _gll_noop expected to be defined in /usr/X11R6/lib/libGL.dylib
OpenGL undefined reference to _gll_pkey expected to be defined in /usr/X11R6/lib/libGL.dylib
Sep 25 21:05:49 wiblesIbook crashdump: Crash report written to: /Users/tomw/Library/Logs/CrashReporter/soffice.bin.crash.log

/Volumes/blueberryUsers/apps/OpenOffice.org1.0.3/oo.app/Contents/Resources/script: line 24: 854 Trace/BPT trap soffice "$@"
2003-09-25 21:05:50.000 Console[606] Exception raised during posting of notification. Ignored. exception: *** NSRunStorage, _NSBlockNumberForIndex(): index (51752) beyond array bounds (51752)

and the crash.log:

**********

Date/Time: 2003-09-25 21:05:49 -0400
OS Version: 10.2.8 (Build 6R65)
Host: wiblesIbook

Command: soffice.bin
PID: 854

Exception: EXC_BREAKPOINT (0x0006)
Code[0]: 0x00000001Code[1]: 0x8fe01220

Thread 0 Crashed:
#0 0x8fe01220 in halt
#1 0x8fe10654 in link_in_need_modules
#2 0x8fe10270 in bind_lazy_symbol_reference
#3 0x8fe00e60 in stub_binding_helper_interface
#4 0x960a3fa0 in driCreatePixelFormat
#5 0x960a428c in driMesaCreateScreen
#6 0x9608758c in AllocAndFetchScreenConfigs
#7 0x960876f4 in __glXInitialize
#8 0x9608578c in glXGetConfig
#9 0x00ea3b8c in SalOpenGL::_MakeVisualWeights(_XDisplay *, XVisualInfo *, int *, int)
#10 0x00eba5c4 in SalDisplay::_BestVisual(_XDisplay *, int, XVisualInfo &)
#11 0x00eb91cc in SalXLib::_Init(int *, char **)
#12 0x00eb8e64 in SalData::_Init(int *, char **)
#13 0x00ec1578 in InitSalMain(void)
#14 0x00d3708c in InitVCL(com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> const &)
#15 0x00d36f2c in SVMain(void)
#16 0x00eb8960 in main
#17 0x000026b0 in _start
#18 0x000024e0 in start

PPC Thread State:
srr0: 0x8fe01220 srr1: 0x0002f030 vrsave: 0x00000000
xer: 0x20000000 lr: 0x8fe09bd8 ctr: 0x8fe293ac mq: 0x00000000
r0: 0x00000004 r1: 0xbfffec00 r2: 0x8fe0b794 r3: 0x0000010f
r4: 0x00000000 r5: 0x0000010f r6: 0x0000000a r7: 0x2e64796c
r8: 0x52362f6c r9: 0x00000000 r10: 0x8fe4850c r11: 0x0000001a
r12: 0x8fe71b36 r13: 0x00000000 r14: 0x00000000 r15: 0x00000000
r16: 0x00000000 r17: 0x00000000 r18: 0x00000000 r19: 0xbffff010
r20: 0x002499f0 r21: 0x00000001 r22: 0x0024aa04 r23: 0x0024b4c0
r24: 0x00249ae0 r25: 0xa6063768 r26: 0x960b4d18 r27: 0x960c0841
r28: 0x8fe4841c r29: 0x8fe484ec r30: 0x8fe484ec r31: 0x8fe0995c

i've emailed fred, hope he can fix it...



[ Reply to This | # ]