One of the unresolved issues from my write-up on Firefox 3, Developing and Browsing was that in order to get it work, you’d need to set the Profile Manager to come up on every launch. This of course starts to get old quite quickly (especially since I had already made a separate instance of Firefox.app so that I could have different icons for the apps).
Unfortunately, while there is a simple command switch (-P [profile]
) to pick the profile, I couldn’t figure out how to add a command switch to an alias, so I set off on a quest to find the best way to launch these apps…
- First I tried using a shell script as a ‘.command’ file. This launches commands in Terminal.app, but unfortunately, both launches a new Terminal window and leaves it open once it’s done. Less than ideal.
- My next series of tests involved using Automator’s “Run Shell Script” functionality, which worked well, except that regardless of what combination of called shell scripts or &s that I added, the Automator App would always wait for the process (Firefox) to finish. That kind of crowding in my applist was something I didn’t need while alt-tabbing.
- I thought I had some success with ‘Run Applescript’ in Automator (with ‘do shell’) that led me try out some combinations in Automator and the Script Editor (Script Editor Apps are smaller, but slower than Automator Apps. Script Editor Apps also lock up and are one of the few apps that have the old B&W spinner instead of a beach ball).
- Finally, I asked around to see if anyone else had tried this before and rcrowley gave the winning answer, which was to give up and write something that would exec a child process. He suggested pcntl_fork in PHP, but I went w/ Python (just because :).
So the end result are two Automator Apps that each contain a single “Run Shell Script” command:
python -c "import popen2; popen2.popen4('/Applications/Firefox.app/Contents/MacOS/firefox -P default')"
python -c "import popen2; popen2.popen4('/Applications/FirefoxDev.app/Contents/MacOS/firefox -P developer')"
They’re named ‘FF.app’ and ‘FFDEV.app’ respectively for easy Quicksilver access, and icons were copy and pasted (through Get Info selection). That took way too long, but it does work as exepected (they launch, and then get out of the way), so hopefully this writeup helps other people that might be looking to do something similar with Automator.
Also, please leave a comment if there’s a dead simple way to do this that I couldn’t figure out.