Skip to content

Configuration ideas

Lev Dubinets edited this page Nov 15, 2021 · 54 revisions

Feel free to add your own ideas for how to use Finicky.

Force https for all urls

{
  match: ({ url }) => url.protocol === "http",
  url: {
    protocol: "https"
  }
}

Matching an array of multiple apps

{
    // Open any link clicked in Mail & Outlook in Google Chrome
    match: ({ opener }) =>
     ["com.apple.mail","com.microsoft.Outlook"].includes(opener.bundleId),
    browser: "Google Chrome"
}

or

{
    // Open any link clicked in Mail & Outlook in Google Chrome
    match: ({ opener }) =>
     ["Mail","Microsoft Outlook"].includes(opener.name),
    browser: "Google Chrome"
}

Open links of example.com including 'Finicky' in the path

{
  match: ({ url }) => url.host.includes("example.com") && url.pathname.includes("Finicky"),
  browser: "us.zoom.xos"
}

Replace domain of urls to amazon.com with smile.amazon.com

{    
  match: "amazon.com/*",
  url: {
    host: "smile.amazon.com"
  }
}

Remove all marketing/tracking information from urls

rewrite: [
    {
      match: () => true, // Execute rewrite on all incoming urls to make this example easier to understand
      url({ url }) {
        const removeKeysStartingWith = ["utm_", "uta_"]; // Remove all query parameters beginning with these strings
        const removeKeys = ["fbclid", "gclid"]; // Remove all query parameters matching these keys

        const search = url.search
          .split("&")
          .map((parameter) => parameter.split("="))
          .filter(([key]) => !removeKeysStartingWith.some((startingWith) => key.startsWith(startingWith)))
          .filter(([key]) => !removeKeys.some((removeKey) => key === removeKey));

        return {
          ...url,
          search: search.map((parameter) => parameter.join("=")).join("&"),
        };
      },
    }
  ],

Redirect google links to duckduckgo.com

{
  match: finicky.matchDomains(["google.com"]),
  url: "https://duckduckgo.com"
}

Open Trello links in Trello app

{    
   match: finicky.matchDomains(["trello.com"]),
   url: ({ url }) => ({
      ...url,
      protocol: "trello"
   }),
   browser: "Trello"
}

Open Spotify links in Spotify app

{
  match: "open.spotify.com/*",
  browser: "Spotify"
}

Open Zoom links in Zoom app

{
    match: [
      "zoom.us/*",
      finicky.matchDomains(/.*\zoom.us/),
      /zoom.us\/j\//,
    ],
    browser: "us.zoom.xos"
}

Open Apple Music links in the Music app

handlers: [
    {
        // Open Apple Music links directly in Music.app
        match: [
            "music.apple.com*",
            "geo.music.apple.com*",
        ],
        url: {
            protocol: "itmss"
        },
        browser: "Music",
    },
],

Open Microsoft Teams links in the native app

handlers: [
    {
      match: finicky.matchHostnames(['teams.microsoft.com']),
      browser: 'com.microsoft.teams',
      url({ url }) {
        return {
          ...url,
          protocol: 'msteams',
        };
      },
    },
],

Open Figma links in Figma app

{
  match: "https://www.figma.com/file/*",
  browser: "Figma",
}

Skip vk.com link tracking (vk.com/away.php)

{
  match: /vk\.com\/away.php/,
  url({ url }) {
    const match = url.search.match(/to=(.+)/)
    
    if (!match) {
      return url
    }
    
    return decodeURIComponent(decodeURIComponent(match[1]))
  },
}

Match multiple conditions

For example, you may want to only open matching URLs in a specific browser when opening those URLs from within a particular application. In that case, you need to match on both the opener and the url:

    handlers: [
      {
        // Open Google Drive in Firefox if opened from Slack
        match: ({ opener, url }) => opener.bundleId === "com.tinyspeck.slackmacgap" && url.host.includes("drive.google.com"),
        browser: "Firefox"
      }
    ]
Clone this wiki locally