Finicky + Firefox Containers
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?
This should do the trick
{
match: () => ["amazon.com/*"],
url: ({ urlString }) => `ext+container:name=Shopping&url=${urlString}`,
browser: {
name: "Firefox",
openInBackground: false,
},
},
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);
},
},
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.
The function is a js function. you can put it before the module.exports in you finicky.js file.
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!)