finicky icon indicating copy to clipboard operation
finicky copied to clipboard

Allow firefox profiles?

Open fa7ad opened this issue 5 months ago • 3 comments

Hi, sorry about the unprompted PR feel free to close/reject but a little context:

I mostly use Finicky to open URLs on a specific Firefox profile based on the opener app's name. Even though v3 didn't officially support Firefox (iirc), I got it working with args as a workaround:

V3 Config:
// Use https://finicky-kickstart.now.sh to generate basic configuration
// Learn more about configuration options: https://github.com/johnste/finicky/wiki/Configuration
module.exports = {
  defaultBrowser: ({ urlString }) => ({
    name: "Firefox Developer Edition",
    args: ["-P", "00-Work", `${urlString}`],
  }),
  handlers: [
    {
      match: ({ opener }) => /telegram|spark|spotify/i.test(opener.name),
      browser: ({ urlString }) => ({
        name: "Firefox Developer Edition",
        args: ["-P", "90-Personal", `${urlString}`],
      }),
    },
  ],
};

This broke completely in V4 and I hit probably the same issue as #431, #460 made it less broken but I was still missing the --new/-n flag on open, so it would just switch to the correct window with this config:

V4 Config (not working)
import type {
  BrowserSpecification,
  FinickyConfig,
} from "/Applications/Finicky.app/Contents/Resources/finicky.d.ts";

const workFirefox: BrowserSpecification = url => ({
  name: "Firefox Developer Edition",
  args: ['-P="90-Personal"', url.toString()]
});

const nonWorkFirefox: BrowserSpecification = url => ({
  name: "Firefox Developer Edition",
  args: ['-P="90-Personal"', url.toString()]
});

const config = {
  defaultBrowser: workFirefox,
  handlers: [
    {
      match: (_, { opener }) =>
        /telegram|spark|spotify/i.test(opener?.name ?? ""),
      browser: nonWorkFirefox,
    },
  ],
} satisfies FinickyConfig;

export default config;

So I decided to look into the code a little bit, and ended up making this change. I got the following config to work now, correctly opening the right profile and I no longer have to use the args workaround at all.

V4 Config (working)
import type {
  BrowserSpecification,
  FinickyConfig,
} from "/Applications/Finicky.app/Contents/Resources/finicky.d.ts";

const workFirefox: BrowserSpecification = {
  name: "Firefox Developer Edition",
  profile: "00-Work",
};

const nonWorkFirefox: BrowserSpecification = {
  ...workFirefox,
  profile: "90-Personal",
};

const config = {
  defaultBrowser: workFirefox,
  handlers: [
    {
      match: (_, { opener }) =>
        /telegram|spark|spotify/i.test(opener?.name ?? ""),
      browser: nonWorkFirefox,
    },
  ],
} satisfies FinickyConfig;

export default config;

I don't know if there are some side-effects to doing this, unless this breaks something I don't really see a reason why firefox profiles shouldn't be allowed the same way Chrome/ium profiles are. (I guess this closes #90).

fa7ad avatar Jul 14 '25 14:07 fa7ad

Very nice! I'll check this out now

johnste avatar Nov 17 '25 18:11 johnste

I'm learning now that there are two different versions of Firefox profiles. This approach seems to work ok for legacy profiles. There doesn't seem to be an approach that works for newer profiles.

However, I'm not opposed to merging this more or less as is. Hopefully it will prove useful for more people.

If you would resolve the conflicts we can move ahead with this. Thanks!

johnste avatar Nov 17 '25 18:11 johnste

Thanks for taking a look, I've updated the PR resolving the conflicts now 😊

fa7ad avatar Nov 19 '25 10:11 fa7ad

Perhaps this isn't the appropriate spot to post this (if so let me know), but it's related to new profiles. After much tinkering, I have discovered that new Firefox profiles can still be activated via the -profile argument, which requires passing an absolute path. This isn't particularly ideal, but perhaps allowing a profile path option could make this slightly more ergonomic in the configuration file.

 browser: (url) => ({
  name: "Firefox",
  args: ["--new", "--args", "-profile", "/path/to/profile/folder", url.toString()]
});

So, maybe an option like:

 browser: (url) => ({
  name: "Firefox",
  profilePath: "/path/to/profile/folder"
});

kovalchik avatar Dec 05 '25 17:12 kovalchik