Getting Adobe AIR to use the default browser under Ubuntu

Adobe AIR logo smallI’ve searched high and low for a good native Linux Twitter client, but there’s nothing out there that can really compete with TweetDeck. At least not in terms of functionality. TweetDeck is based on Adobe’s AIR platform and as a result is quite heavy on resources. But the biggest problem I had with it was getting it to open links in my default browser. It disregarded my setting and used Firefox to open all links. Twitter is far less fun if you need to carefully copy paste every link to a new tab in your browser. As it turns out, the issue is with AIR, not just TweetDeck, and it took quite a while and a lot of help for me to find a working solution.

Deprecated variable

If I understand correctly, AIR uses and old (deprecated) so-called ‘environment variable’ to determine of Gnome is the active windows manager. Gnome is default for Ubuntu, but because AIR asks it the wrong question, it’s never asked what the default browser is. The solution to this is to set the deprecated variable manually, before you launch TweetDeck or any other AIR Application.

Fortunately, there’s the ever-helpful Linux community to save the day. With lots of help from @SundeepM, I was able to set up the following little script that does just that.

export GNOME_DESKTOP_SESSION_ID=Default
/opt/TweetDeck/bin/TweetDeck

The first line sets the GNOME_DESKTOP_SESSION_ID variable to ‘Default’, so it’s ready to be checked by AIR. The second line launches TweetDeck. I’ve saved this to my desktop, given it permission to be executed (right-click -> permissions) and use it instead of the regular TweetDeck icon. This workaround works wonderfully for me and links now open in Chromium rather than Firefox.

Work in progress

There are probably more elegant solutions that set the variable without having to manually fire off a script every time. I’ve tried adding it to files like .bash_profile, .xsession and .profile, but that got me nowhere. If you have a solution that works in Ubuntu 9.04, please leave it in the comments. And let’s hope Adobe fixes this in future releases of their software. That would of course be the preferred solution.

34 Comments

  1. I found an esier way to do this, I think, one that works for me anyway. NOTE that you need to do this with root privs (sudo).

    When I looked into the /opt directory, I saw that there were three folders there – one for Adobe AIR, one for TweetDeck, and one for firefox. (The firefox directory was not a symlink. This is marginally troubling and might explain why upgrading your system to Ffox3.5 isn’t recognized by TweetDeck, and it still loads Ffox3.)

    TweetDeck seems to be hardwired to load /opt/firefox/firefox when opening a URL. But it doesn’t actually seem to care if it’s really Firefox it loads or not.

    Here’s the shortened version of what I did. About half of it was guesswork and trial-and-error, but it worked.

    1. In /opt, rename the firefox directory to something like ffox.
    2. Create a new directory in /opt called firefox.
    3. Copy the script or symlink to the browser of your choice into the firefox folder you just created.
    4. Rename that script or symlink firefox.

    After that, TweetDeck should use the browser you want.

    Comment by Warren — September 3, 2009 @ 9:10 pm

    • Hi Warren. I’m not sure that’s much easier. And if I understand correctly, you’d have to repeat the last couple of steps each time you switch default browsers?

      Comment by Roy — September 4, 2009 @ 8:12 am

  2. Link: blog.godstroke.com » Force Adobe Air to open urls in default browser on gnome-linux
  3. Thanks for this tip. It was very helpful.

    There is a slightly more elegant way to do the same thing. Simply add your “export GNOME_DESKTOP_SESSION_ID=Default” to your .bashrc file in your home directory (create it if it doesn’t exist). You have to log out and back into Gnome before this will take affect, but it requires no changes to the TweetDeck launcher

    Comment by Dan Martin — September 6, 2009 @ 4:59 am

  4. Hi Dan. I tried that and it doesn’t seem to work for me. Links still open in Firefox, even after a full restart.

    Comment by Roy — September 6, 2009 @ 8:49 am

  5. In my GNOME Menu I just changed Tweetdeck’s command to:
    export GNOME_DESKTOP_SESSION_ID=Default && /opt/TweetDeck/bin/TweetDeck

    :]
    seamless.

    Comment by Jay — September 8, 2009 @ 3:18 pm

    • Hi Jay. Could you tell me how to do that step by step? If I simply modify my launcher panel shortcut’s command I get and error about ‘export’ not being available. There are also several extra ‘ characters in the original command string (presumably to escape characters?)

      Comment by Roy — September 9, 2009 @ 8:50 am

  6. http://jvdthwip.googlepages.com/mainmenu-properties-command.png

    Under System->Preferences->Main Menu, you can edit the command which launches the application.
    Find Tweetdeck in your menu structure, highlight it, hit Properties.
    There’s a command field where you can enter –

    export GNOME_DESKTOP_SESSION_ID=Default && /opt/TweetDeck/bin/TweetDeck

    Close the properties window, close the Main Menu options.
    Tweetdeck’s shortcut on your Menu should work. It works on my system, and I don’t see any specific reason why it wouldn’t.

    NINJA EDIT:
    Huh! Interesting.
    I dragged the working Tweetdeck shortcut from my Menu to my desktop to create a launcher, and I got your error:

    There was an error launching the application.
    Details: Failed to execute child process “export” (No such file or directory)

    I checked the interwebs and found that I need to set the launcher to type “Application in terminal.”

    NINJA EDIT 2:
    I tried that, and now the terminal “cannot create child process.”
    This is too much of a hassle.

    I figured out that the reason it worked for me on my Menu is because I was using a menu called Cairo Menu (a KDE-like GNOME menu alternative). Apparently it launches applications differently, despite using all the menu settings from the Sys>Prefs>Main Menu config.

    Since a launcher can’t execute the commands right, I guess you have to use your original idea with a script or use some menu/launcher applet that can run commands like this. :x

    Sorry.

    Anyway it works for me. >:D

    Comment by Jay — September 9, 2009 @ 5:28 pm

  7. Hi Jay, thanks for looking into it and posting your findings. Too bad your solution doesn’t apply to my case.

    Comment by Roy — September 9, 2009 @ 6:12 pm

  8. I cant get the script working on my 9.04 if anyone have any ideas … im using twhirl so i changed /opt/TweetDeck/bin/TweetDeck for /opt/Twhirl/bin/Twhirl

    Comment by Jorge — September 11, 2009 @ 2:34 am

    • Jorge, are you sure that is in fact the path to Twhirl?

      Comment by Roy — September 11, 2009 @ 8:53 am

  9. I created a shell script called tweetdeck.sh in my home directory the contents of the file are:

    “export GNOME_DESKTOP_SESSION_ID=Default && /opt/TweetDeck/bin/TweetDeck”

    i then made it executable:

    chmod a+x tweetdeck.sh

    finally i changed the launcher command to /home/username/tweetdeck.sh and re-added the nifty icon under the launcher properties

    It gets the job done

    Comment by Brian — September 18, 2009 @ 4:36 am

  10. I did the same as Brian (above). Works like a charm. Just change the properties on the launcher. =)

    Comment by Greg — September 22, 2009 @ 2:58 pm

  11. I went looking for the same stuff, but it seems like my TweetDeck (and Adobe AIR?) is just launching “firefox”. So doing this fixed mine with 3.5 by doing:

    cd /usr/bin
    sudo ln -s firefox-3.5 firefox

    Comment by Andre — September 23, 2009 @ 2:46 pm

  12. Adobe AIR will call the command “firefox,” so what I did was rename my firefox executable, then add a symlink for chromium-browser called “firefox”

    sudo ln -s /usr/bin/chromium-browser /usr/bin/firefox

    Problem solved. Even easier if all you want to use is Firefox 3.5/Shiretoko, since the executable is firefox-3.5 and not firefox, so you don’t need to make any other changes (like to launchers and such)

    Comment by Steve — September 23, 2009 @ 8:08 pm

  13. Link: Lograr que Adobe Air ejecute correctamente el navegador por default en Gnome » Ca Diidxa
  14. Try this for your launcher command:

    bash -c “export GNOME_DESKTOP_SESSION_ID=Default; /opt/TweetDeck/bin/TweetDeck”

    Comment by John — October 14, 2009 @ 8:36 pm

  15. Thanks @John
    It works great and also can be used to replace the gnome menu command (with a bonus: it’ll work for gnome-do).
    I just needed to fix the quotes:
    bash -c “export GNOME_DESKTOP_SESSION_ID=Default; /opt/air/TweetDeck/bin/TweetDeck”

    Comment by GRO — October 15, 2009 @ 4:58 pm

  16. Link: Make TweetDeck and Other AIR Apps Use Your Chosen Browser [Adobe AIR] · TechBlogger
  17. Link: Mash123 » Make TweetDeck and Other AIR Apps Use Your Chosen Browser
  18. Link: Make TweetDeck And Other AIR Apps Use Your Chosen Browser | Lifehacker Australia
  19. Link: Make TweetDeck and Other AIR Apps Use Your Chosen Browser [Adobe AIR] « Coolbeans
  20. Refinement for above, for Fedora 11;

    Launcher with command:

    bash -c ‘GNOME_DESKTOP_SESSION_ID=Default /opt/TweetDeck/bin/TweetDeck’

    Changes:
    – single quotes
    – no export, one line
    – path change; where mine installed

    Comment by Momo — October 16, 2009 @ 5:18 am

  21. The export line is how you would do it from a shell script or from the command line. To have the same effect from the menu, use `env’ rather than `export’ and take out the `&&’.

    This isn’t my trick. I discovered it when installing Windows programs with Wine. If I use an alternate WINEPREFIX when I install the program, it automatically creates that menu entry and the command takes the form of `env WINEPREFIX=/home/ghodmode/ wine “C:\\Program Files\\\\runme.exe”‘.


    — Ghodmode

    Comment by Ghodmode — October 20, 2009 @ 12:44 am

  22. This has been fixed in 2.0 Beta release of Adobe AIR. Now every AIR application opens up links in default browser (be it chrome, firefox or opera etc).

    Comment by syed — November 26, 2009 @ 10:58 am

    • AIR 2 is still in beta right? I’d be very happy not to have to use a workaround for this.

      Comment by Roy — November 27, 2009 @ 3:06 pm

  23. Link: Google Chrome on Air™ « SKURO!
  24. Thanks for posting this. I don’t know how what that first person said is easier. Creating a script is really easy and it can be save anywhere and easily removed. Safer than changing /opt/bin files.

    Comment by Jay — December 8, 2009 @ 10:10 pm

  25. hi,

    like your workaround … unfortunately i don’t know how to get gnome-do to start that script … do you have any ideas?

    regards,
    kajdo

    Comment by kajdo — December 13, 2009 @ 9:39 pm

  26. Link: Hacer que Tweetdeck utilice tu navegador preferido [Linux] « @~
  27. Link: Make TweetDeck(Adobe Air) to use default Browser in Ubuntu « .:DE$TROY3R:.
  28. For KDE, KUBUNTU, and likes…

    Go to K Menu
    Then System Config
    And Default apps

    Set default browser to Firefox, chrome …

    Comment by Pablo — December 30, 2009 @ 4:36 pm

  29. Hi
    These workarounds are no longer required with the latest release version of AIR(1.5.3)
    Everything from default browsers to default email clients is correctly detected by AIR :)

    Comment by SundeeM — February 15, 2010 @ 7:08 am

    • SundeeM. Thanks for the update. Good thing they changed that, this whole situation was rather silly to begin with.

      Comment by Roy — February 16, 2010 @ 12:00 pm