When a review is created (or new files are added to an existing review) from a Code Collaborator client tool, the client launches the user's browser to the review creation wizard (or review overview screen) where the real work is done. Browser launching varies from platform to platform. We use an open source library, BrowserLauncher2, to abstract away those platform dependencies. That worked great until a user emailed today to say, "I want to use Chrome on Linux as my browser, but Code Collaborator always launches Firefox". Time to dig in and get my hands dirty.
At its core, BrowserLauncher2 uses configuration files embedded in their jar to map from a browser name to a command line to invoke to launch it. Unfortunately, it does not appear to have a system property or other means of overriding (or augmenting) where it gets that configuration. If it did, we could just package up a new configuration file with our applications and be fine.*
I spent some time considering a patch that would enable overriding the defaults, but the project looks mostly dead, the HEAD of their CVS repository does not build cleanly, and there are no CVS tags for their releases, I decided it probably wasn't worth it. Instead I just repackaged the jar with the following extra configuration:
browser.gnomeopen=GNOME open;gnome-open;<browser> <url>;<browser> <url>
browser.xdgopen=XDG open;xdg-open;<browser> <url>;<browser> <url>
browser.kdeopen=KDE open;kde-open;<browser> <url>;<browser> <url>
That's right, no explicit mention of Chrome. Linux already has at least three tools that allow users to configure their default browser. There was no need to add Chrome support directly. As an added benefit, we are future-proofed against new browsers making life inconvenient for our users.
If you want to have this functionality, you'll need Code Collaborator 5.0.5025 or newer (not available as of this writing) and run the following command (or variant):
ccollab set browser "GNOME open"
Make sure you have your chosen launcher configured to open the browser of your choice. We don't guarantee we'll support your browser, but if it works for you we won't try to stand in your way.
* Writing this, I realized that given the BrowserLauncher2 code is LGPL (including the properties files) and that any configuration we packaged would be derivative of those configuration, we would have to be careful how to package the configuration files so as to not encumber our entire application: