finicky icon indicating copy to clipboard operation
finicky copied to clipboard

Finicky + Firefox Containers

Open adam-fox opened this issue 4 years ago • 6 comments

Hi! Hoping someone here may be willing to help me out. I'm trying to use Finicky to open specific Firefox Containers and found a Firefox Extension (https://github.com/honsiorovskyi/open-url-in-container) that I thought I could make work. Unfortunately, I'm just not qualified to hack together a solution on my own. Anyone have any thought on how I could setup my config to make this work?

adam-fox avatar Sep 29 '21 14:09 adam-fox

This should do the trick

{
  match: () => ["amazon.com/*"],
  url: ({ urlString }) => `ext+container:name=Shopping&url=${urlString}`,
  browser: {
    name: "Firefox",
    openInBackground: false,
  },
},

mikemajara avatar Feb 21 '22 21:02 mikemajara

I was having some trouble with doing it that way if the URL has any parameters in it.

I created a function to DRY this up, but also URLencodes the incoming URL so the container plugin doesn't break things:

function openInFirefoxContainer(containerName, urlString) {
  return `ext+container:name=${containerName}&url=${encodeURIComponent(
    urlString
  )}`;
}

Usage:

{
  // Some prefix => Work container
  match: "https://example.com/*",
  url: ({ urlString }) => {
    return openInFirefoxContainer("Work", urlString);
  },
},

whi-tw avatar Apr 13 '22 07:04 whi-tw

I came across this and wasn't sure where to put the function code above. Tried putting it in my .bash_profile but Finicky complained with an error: Configuration: ReferenceError: Can't find variable: openInFirefoxContainer .

In the end I went with the following:

{
  // Some prefix => Work container
  match: "https://example.com/*",
  url: ({ urlString }) => `ext+container:name=Work+Profile&url=${encodeURIComponent(urlString)}`,
  browser: "Firefox"
},

The above opens the link correctly in my Work Profile container of Firefox.

rakheshster avatar Aug 24 '22 10:08 rakheshster

The function is a js function. you can put it before the module.exports in you finicky.js file.

mathieutu avatar Sep 01 '22 08:09 mathieutu

Sorry @rakheshster, missed this. @mathieutu's right:

function openInFirefoxContainer(containerName, urlString) {
  return `ext+container:name=${containerName}&url=${encodeURIComponent(
    urlString
  )}`;
}

module.exports = {
  defaultBrowser: "Firefox",
  options: {
    urlShorteners: (list) => [...list, "shorturl.at", "www.shorturl.at"],
  },
  handlers: [
    {
      // Some prefix => Work container
      match: "https://example.com/*", 
      url: ({ urlString }) => {
        return openInFirefoxContainer("Work", urlString);
      },
    },
  ]
};

(untested snippet, but presumably it will work!)

whi-tw avatar Sep 01 '22 08:09 whi-tw