Custom application launchers in Dock?

N

nanoo

Guest
Custom application launchers in Dock? [RESOLVED]

Hi,

I'm wondering whether anyone has explored putting custom application launchers in their Dock. It was, of course, easy to add applications that already had an icon to the Dock (just by dragging), however I had something else in mind: I want to get an application launcher for XMMS in the Dock as well if possible. I have XMMS installed through FINK, and it works great, the only problem being that to launch it I must first start up X11, run /sw/bin/xmms, enter my password, etc, etc. Is it possible to avoid all that by programming an application launcher that I can keep right in the Dock? I've looked around (mostly just googling variations on this theme) and haven't found anyone who has done this... anyone have any hints/advice?

Thanks in advance,

nanoo
 
Joined
Jun 11, 2003
Messages
4,915
Reaction score
68
Points
48
Location
Mount Vernon, WA
Your Mac's Specs
MacBook Pro 2.6 GHz Core 2 Duo 4GB RAM OS 10.5.2
Look at an app called Platypus I believe that's what it's called. You can find it on macupdate.com
 
OP
N

nanoo

Guest
Thanks for the reply Murlyn - I think this Platypus is exactly what I'm looking for. I think I have a problem with the code however... I think to do with getting X11 to start up. I don't really know anything about programming - just the basics to get by on a Mac or *NIX system - if anyone can help me here I would really appreciate it.
So this is what I had in the file that I want Platypus to launch to get XMMS up and running:

Code:
#!/bin/sh

# An attempt to launch xmms in the Tiger interface

/sw/bin/xmms

So I created an application launcher with that using Platypus, but it gives as output:

Code:
*** CRITICAL ***: Cannot open display

Any ideas? Is it an X11 thing?

Thanks,

Daniel
 
Joined
Jun 11, 2003
Messages
4,915
Reaction score
68
Points
48
Location
Mount Vernon, WA
Your Mac's Specs
MacBook Pro 2.6 GHz Core 2 Duo 4GB RAM OS 10.5.2
I have no idea.. hopefully someone else does.
 

rman


Retired Staff
Joined
Dec 24, 2002
Messages
12,637
Reaction score
168
Points
63
Location
Los Angeles, California
Your Mac's Specs
14in MacBook Pro M1 Max 32GB 2TB
It is an X11 thing. The application that you are running does not have permission to display anything on your display window.

Normally you would do an xhost "ip address" (.i.e xhost 169.230.14.5) or xhost +. Then you would sst your display to your ip address. If you are uingin korn shell you would issue the command export DISPLAY 169.230.14.5:0. Bourne shell DISPLAY=169.230.14.5:0; export DISPLAY and c shell setenv DISPLAY 169.230.14.5:0.
 
OP
N

nanoo

Guest
Thanks rman, I think that exporting DISPLAY business is exactly what I need. I have hit another snag though...
I changed the script to:

Code:
#!/bin/sh

# An attempt to launch xmms in the Tiger interface
xhost 169.230.14.5
DISPLAY=169.230.14.5
export DISPLAY
/sw/bin/xmms

and now I get the following output:

Code:
/Users/nanoo/Desktop/xmmslaunch.app/Contents/Resources/script: line 4: xhost: command not found

** CRITICAL **: Unable to open display

So the problem clearly is that it can't find xhost... and I can't find it either. I've looked all over for it - I can't find any of my X stuff anywhere on my system. Is there a place where these things normally live? I have XFree86 4.4.0 on my Mac system.

At any rate, if anyone knows where I can find the files for X11 (isn't there normally an X11 folder somewhere?), I'd really appreciate it - I think that's all I need to get this working :),

Thanks,

nanoo
 

rman


Retired Staff
Joined
Dec 24, 2002
Messages
12,637
Reaction score
168
Points
63
Location
Los Angeles, California
Your Mac's Specs
14in MacBook Pro M1 Max 32GB 2TB
Do you have the X11 windowing system installed on your system? Because xhost is part of that system.

Also in your script, you will need to modify the line "DISPLAY=169.230.14.5" to "DISPLAY=169.230.14.5:0".
 
OP
N

nanoo

Guest
Thanks for catching that typo rman - I neglected to check that.

Ok, so I found xhost (I had thought that my whole system was in the /sw - it turns out that the usr folder and others are in the root directory), and that settles that problem, however it doesn't seem to be able to open the display. This is the output it gives:

Code:
/usr/X11R6/bin/xhost:  unable to open display ""

This is the script the launcher pointed to (I corrected the typo before running the launcher):

Code:
#!/bin/sh

# An attempt to launch xmms in the Tiger interface
/usr/X11R6/bin/xhost 169.230.14.5
DISPLAY=169.230.14.5:0
export DISPLAY
/sw/bin/xmms

I checked that the script was executable (permissions are 755), but other than that I couldn't think of why launcher wouldn't work.

Any ideas? Thanks for all the help so far - I've got to be close at this point!

nanoo
 

rman


Retired Staff
Joined
Dec 24, 2002
Messages
12,637
Reaction score
168
Points
63
Location
Los Angeles, California
Your Mac's Specs
14in MacBook Pro M1 Max 32GB 2TB
You can try xhost + and see if that will work.
 
OP
N

nanoo

Guest
Thanks again for the help rman. Unfortunately xhost + didn't work - the same result as when I gave an explicit IP address.
However I think I made some progress this morning: I realized that it was only when I typed
Code:
/sw/bin/xmms
in an xterm that I could get it to launch.
When I tried it in a terminal, I got the same error message that the platypus program was giving me. Sure enough, when I would run:
Code:
/usr/X11R6/bin/startx
and then
Code:
/sw/bin/xmms
in the xterm that came up, then xmms launched with no problems.

So of course the next thing I tried was to change the script to:
Code:
#!/bin/sh

/usr/X11R6/bin/startx
/sw/bin/xmms

However I noticed that the launcher seemed to hang after starting X. So my problem is this:
Is it possible to write a program that will start X, then run new scripts in the xterm that comes up? When I do this manually everything works great. It's just a matter of getting it to work in one single script, that I can attach to a launcher.

As before, any help would be greatly appreciated.

Thanks,

nanoo
 
OP
N

nanoo

Guest
Well, it turns out the solution to my problem was so simple...
I simply dragged the xmms icon in /sw/bin to the dock, and it worked perfectly (it knew to launch it with X11), and so the script problem has become totally moot.

Thanks for the help!

nanoo
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top