Open the right browser for a given URL with Finicky

For years, I’ve hated the fact that when I click a link it opens not in the browser that I wanted. If like me, you work with multiple browsers you might know the feeling. We’ll see how you can solve this problem with an OSS tool Finicky, that code source is available on Github.

Let’s say that you would like to :

That’s approximately what my setup looks like right now, and I handle it easily with Finicky, plus some extras.

One important thing to understand is that Finicky will only intercepts links that are clicked outside of a browser, it won’t work when you are clicking links already in a browser, or typing in the browser bar, but when you click on a link in your Mail application, your chat application, …

Let’s configure Finicky

Finicky is a Mac OS application that needs to be set as your default browser in your system preferences. Once it’s done, it behaves as a link handler and every link will be processed by Finicky so it can decide which browser will be used for a given link.

The config file for Finicky is located in ~/.finicky.js, it stores the default browser that will be used to open links that don’t match any rules, all the rules that you want Finicky to respond to and you can put some rewrites rules.

If you want the same behaviour as I described previously, you can copy the following snippet :

// https://github.com/johnste/finicky/wiki/Configuration
module.exports = {
  options: {
    hideIcon: true, // Hide the finicky icon from the top bar.
    checkForUpdate: true, // Check for update on startup.
    logRequests: false, // Log every request with basic information to console
  },
  defaultBrowser: "Safari",
  handlers: [
    /* Open work links in Firefox */
    {
      match: [
        finicky.matchDomains(/localhost/),
        finicky.matchDomains(/127\.0\.0\.1/),
        finicky.matchDomains(/.*\.myticketstool.net/),
        finicky.matchDomains(/.*\.myrepositories.net/),
        finicky.matchDomains(/.*\.mycompany.net/),
      ],
      browser: "Firefox",
    },
    /* Open Sentry link in Opera */
    {
      match:[
        finicky.matchDomains(/.*?\.sentry.io/),
      ],
      browser: "Opera",
    },
    /* Open any google link in Chrome */
    {
      match: [
        finicky.matchDomains(/.*\.google.com/),
      ],
      browser: "Google Chrome",
    },
    /* Open any links from Slack in Firefox */
    {
      match: ({ opener }) => opener.bundleId === "com.tinyspeck.slackmacgap",
      browser: "Firefox",
    },
  ],
  rewrite: [
    ...
  ],
};

One interesting thing in the configuration is that Finicky can detect the application by its bundleID that was used to open the link, that way you can force any link open in Slack (in the example) in Firefox.

So, if you take this file and adjust the placeholders values that I used, you’ll see that when you click your links it will open in the desired browser.

Your custom rules

What if you want more ? Beacause Finicky offers lots of configuration possibilities, it has a large Wiki, with all the things that Finicky can do for you, and even offers some ideas of ready configurations.

But if you don’t find what you want in the wiki you can as well use a small webapp, that will ease the process to create your own rules.

Once you are set, Finicky includes a Console, that helps debugging or tweaking some cases to get your perfect configuration :

Capture of Finicky console

(Yeah I know I don’t have Opera installed on my Mac but it was for the demo 😏 )

I’ll repeat because, I didn’t fully understand it in the beginning, Finicky will only works with links that you click !

Why you should at least try Finicky ? Because it’s lightweight, easy to configure and it will make your life easier. Once configured you totally forgot that Finicky is running in the background and you won’t need to manually copy/paste a link to a browser any more.

What are some extras Finicky offers ? Finicky can rewrite some urls, force HTTPS or force HTTP when working with localhost of course, it can remove UTM tracking parameters from a URL, replace some domain by another. It’s really powerful and I use it to set basic authentication in some domains that are «secured» at work. I’ve another matcher that generates a review links based on a Jira ticket number. You can do a lot of things if you have the imagination to code it.

Final note

I hope this post will make you want try Finicky or any other tool that could save you a little time and keep your browsers tabs a little more organized.

I’ve been using Finicky for years, but never talked about it because the project was marked as «not being actively maintened» a couple of years back, but it’s not the case anymore as it’s not marked in the README anymoore. For me, it’s a mandatory kind of tool that I can’t leave without.

If you don’t want use Finicky, there are other solutions available and I encourage you to look at such tools but to me Finicky does just what I need, and that’s enough.

_[OSS]: Open-source Software _[UTM]: Urchin Tracking Module