I use this so much with out thinking that I completely forgot I made it a while ago, I thought I would share. Anytime I tried to target the Firefox binary from an external app, Firefox would ask me to use another profile since the default one was in use and Firefox didn't like multiple instances of itself running.
Its simple and to the point. Essentially it checks for a running instance of a target Mozilla-based browser, then either creates a new instance or a new tab. You can use the commented out line to create a new window rather than a new tab. Copy and paste this into a file, make it executable, stick it someplace handy and target it with your apps that need a browser. (OpenOffice, Email App, etc.)
Code:
#!/bin/bash
#Path to the Mozilla-based browser binary (alliterate much?)
MOZILLA=/usr/share/firefox/firefox
if ($MOZILLA -remote "ping()"); then
$MOZILLA -remote "openurl($1, new-tab)" &
#$MOZILLA -remote "openURL (URL, new-window)" &
else
$MOZILLA $1 &
fi
Let me know if you have any questions.
Bookmarks