You can kill the background for speed, if you wish.[x]

Monday, November 9, 2009

Getting Adobe Air to Recognize Your Default Browser

Among the issues I have re-encountered in reinstalling my Ubuntu fresh is that links from TweetDeck open up in Firefox, instead of Chrome, my default browser. Chrome on Linux, by the way, is still only available from the dev channel. It's readily available, but still has its share of issues - currently, my dropdown boxes are blank when I try to select an option. They get fixed - that particular isse has been taken care of already and will be fixed in the next release - but it's still iffy. That said, it is way zippier in Linux than Firefox, which is pretty much dog-slow at times, in my experience.

Anyway, for these reasons, I wanted TweetDeck to respect my default browser, but it stubbornly insisted on opening links in Firefox. Since I generally don't have it open, it takes a few seconds to open Firefox and load the page, instead of popping up Chrome with my page already displayed pretty much instantly. It didn't take long before it got on my nerves, and I remembered that I had fixed this before. A quick trip to the (one guess) Ubuntu forums pointed me to a very helpful post by Andrea Olivato, detailing how to fix this without resorting to really nasty hacks like symlinking Firefox to Chrome.

Turns out that Adobe, in all its wisdom, decided to hardcode Firefox into their binary for opening links. Brilliant. Which means that you have to get your hands dirty doing a little bit of hex editing and, yes, symlinking. Because for the hex editing, the string for the browser has to have the same number of characters as "Firefox", so you don't screw everything up. Andrea had the clever idea of symlinking "browser" to your desired browser, which is good semantically, and has the same number of characters as "Firefox". Perfect! His commenters further improved upon the fix by suggesting that "browser" be symlinked to either x-www-browser or xdg-open. Both are generic "default browser" options. After reading up a bit, I still don't really know which is "better". I think I like xdg-open though. So, here's how to Fix It Right, based on Andrea's instructions, with the commenters' suggestions integrated in:

Before anything, do a sudo su to get into a root prompt. Then, symlink the desired default-browser alias (xdg-open or x-www-browser) to "browser" in /usr/bin:

root@geekmobile# ln -s /usr/bin/xdg-open /usr/bin/browser
Then find your file with a locate:
root@geekmobile# locate
/opt/Adobe AIR/Versions/1.0/
With your hex-capable editor of choice (Vim in my case, gEdit isn't going to do it this time), open the file found via the locate command:
root@geekmobile# vi /opt/Adobe\ AIR/Versions/1.0/
Find where it says "openURL" in the file. In Vim this is a simple as a /openURL<enter>, but of course this depends on your editor. Then replace the "firefox" right after that point with the word "browser" (which you symlinked above to your default browser). Save the file, restart TweetDeck (or whatever Air app you're using), and enjoy quicker, better link-opening! Hurrah.

And again, many thanks to Andrea for the tips!

No comments: