?

Log in

No account? Create an account

hackety hack

« previous entry | next entry »
Dec. 29th, 2007 | 01:08 am

Today I solved a problem with OS X which I think only I have. It's that I often switch which browser I'm using, and if I have Camino open, and Safari set as my default browser, I want links I click on in other applications to open in Camino because it's open, not Safari even though it's my default.

So Josh said, write a new app that pretends to be a browser and opens links in whatever browser is open. So tonight, I did.

I call it Link Toss. The icon is three times the size of the program itself. Download it here. (only tested in Leopard but had better work in Tiger, universal binary, yadda yadda yadda). Open DMG, drag application to your Applications folder, and set Link Toss as your default app in Safari/Camino Preferences. Sorry the icon sucks, I've got an idea for a better one.

One Caveat:
  You can't set your default browser when you have no browser open. Link Toss will just open them in /Applications/Safari.app.

Oh, also I somehow got deep down in really esoteric weird stuff involving the Apple Event Manager and bizarre confusing Carbon low level event-stuff. I'll put the source out for this thing if anyone cares, but is there a way to handle URLs without this apple event manager thing? I grepped through Camino's source and didn't find any mention of appleEventManager, so I bet there is. Too bad nobody who reads this knows anything at all about os x programming.

Lastly I could've probably done this with applescript with a lot less trouble, except I've already failed twice at trying to understand how AppleScript's syntax works (and I usually learn languages pretty fast). It would be slower anyway. Plus, I'm not entirely sure AppleScript gives you access to things like every program registered as a URL handler, for which I used Launch Services' LSCopyApplicationURLsForURL. Ugghhh APIs.

| Leave a comment |

Comments {5}

Alana

(no subject)

from: treshirecat
date: Dec. 29th, 2007 08:56 pm (UTC)

i have that problem too. problem solved. thanks!!

Reply | Thread