finicky icon indicating copy to clipboard operation
finicky copied to clipboard

Support for Firefox profiles

Open llange opened this issue 5 years ago • 13 comments

I'd like to see some support for Firefox Profiles (ability to open some urls in one or another profile, having both instances open and directing urls to one instance or another). It will involve the use of some specific command line options (-P, --no-remote).

Use-case

My ideal use-case is the following:

  • I'm using firefox
  • I work for multiple customers and I keep them isolated in different browser profiles (+ one 'personal' profile)
  • I open as many firefox instances as I need - generally I have 2 instances opened (one with the 'personal' profile, the other with my current customer profile) but I can have more.
  • I'm using Finicky to direct some links in one, or another, instance

Workaround

As there is currently no support for profiles in Finicky, I was using, until recently, the following workaround:

  • I have one Firefox installation
  • For each customer or profile, I create a mock "application" in ~/Applications/, i.e. a subfolder named Firefox-<customer1>.app and containing:
./Contents/Info.plist
./Contents/MacOS/firefox-customer1

with: ./Contents/Info.plist being a copy of ~/Applications/Firefox.app/Contents/Info.plist with the following changes:

  • CFBundleExecutable changed from firefox to firefox-<customer1>
  • CFBundleIdentifier changed from org.mozilla.firefox to org.mozilla.firefox-<customer1>
  • CFBundleName changed from Firefox to Firefox-<customer1>

and ./Contents/MacOS/firefox-<customer1> being:

#!/bin/sh
exec $HOME/Applications/Firefox.app/Contents/MacOS/firefox-bin -P "<Customer1Profile>" --no-remote "$@"

This workaround used to work fine and allowed me to use, in Finicky, the bundle Id to refer to the browser: I could use this to refer to the default browser:

    defaultBrowser: {
        name: 'org.mozilla.firefox',
        appType: 'bundleId',
        openInBackground: false
    },

or this to refer to the browser for customer1:

browser: {
    name: 'org.mozilla.firefox-<customer1>',
    appType: 'bundleId',
    openInBackground: false
}

Unfortunately, a few Finicky versions ago, it stopped working (for non default browsers). (I did not notice at which version the change occurred)

I did not dig it too much, but in the logs I have the following error message (Note: Using Catalina 10.15.1):

2019-12-09 13:47:05.802952+0100 0xa9f584   Default     0x0                  45389  0    open: (LaunchServices) [com.apple.launchservices:open] Opening URL <private> with application <private>
2019-12-09 13:47:05.809145+0100 0xa9f584   Default     0x0                  45389  0    open: (LaunchServices) [com.apple.launchservices:open] _LSLaunch('<private>')
2019-12-09 13:47:05.811925+0100 0xa9f584   Default     0x0                  45389  0    open: (LaunchServices) [com.apple.processmanager:front-35286506] LAUNCHING:0x0-0x888888 Firefox-<Customer1> foreground=1 bringForward=1 seed=6891 userActivityCount=0
2019-12-09 13:47:05.813343+0100 0xa9f584   Error       0x0                  45389  0    open: (LaunchServices) [com.apple.launchservices:cas] LaunchedApplication: failed with error -13052 (null){ "ApplicationType"="Foreground", "BundleIdentifierLowerCase"="org.mozilla.firefox-<customer1>", "CFBundleExecutablePath"="/Users/llange/Applications/Firefox-<Customer1>.app/Contents/MacOS/firefox-<customer1>", "CFBundleExecutablePathDeviceID"=16777223, "CFBundleExecutablePathINode"=1440551, "CFBundleIdentifier"="org.mozilla.firefox-<customer1>", "CFBundleName"="Firefox-<customer1>", "CFBundlePackageType"="APPL", "CFBundleSignature"="MOZB", "LSASN"=ASN:0x0-0x888888:, "LSBundlePath"="/Users/llange/Applications/Firefox-<Customer1>.app", "LSBundlePathDeviceID"=16777223, "LSBundlePathINode"=1440545, "LSDisplayName"="Firefox-<Customer1>", "LSExecutableFormat"="LSExecutable#!Format", "LSLaunchDLabel"="org.mozilla.firefox-<customer1>.8412", "LSLaunchedByLaunchServices"=true, "LSLaunchedInQuarantine"=true, "LSLaunchedWithLaunchD"=true, "LSLaunchEventRecordTime"=384911881317822, "LSLaunchTime"=now-ish 2019/12/09 13:47:05, "LSWantsToComeForwardAtRegistrationTimeKey"=true, "pid"=62000 }
2019-12-09 13:47:05.813887+0100 0xa9f584   Default     0x0                  45389  0    open: (LaunchServices) [com.apple.launchservices:open] OSStatus _LSLaunch(LSContext *, FSNode *, LSLaunchFlags, void *, CFArrayRef, const AppleEvent *, const AEDescList *, CFArrayRef, CFDictionaryRef, LSBundleID, const audit_token_t *, const _LSOpen2Options *, ProcessSerialNumber *, Boolean *, NSError **): launching '<private>' result=0

May be I'm able to fix it, but it still is a workaround, and in this time of quarantined, notarized applications, there is no guarantee that my workaround setup is viable long term.

Thus I believe proper support for browser command lines (like in #89) or profiles (browser-specific, see also #40) is cleaner for this kind of use-case.

Thanks !

llange avatar Dec 09 '19 12:12 llange

@llange, I suspect that this stopped working due to updating to Catalina and not due to a Finicky version update.

ldub avatar Feb 02 '20 19:02 ldub

Hi @ldub , I'm pretty sure you're right, I didn't make the link but I had a (forced) upgrade to Catalina which do coincide with the breakage.

I do hope to find a way to make my setup work again...

llange avatar Feb 02 '20 19:02 llange

As I mentioned here https://github.com/johnste/finicky/issues/40#issuecomment-581168657 , other apps have this problem too. One was able to find a workaround, but overall it seems like a macOS bug that we need to report to Apple, or potentially a sandboxing "feature" that they have added to Catalina.

ldub avatar Feb 02 '20 19:02 ldub

Hi @llange , did you find any workaround. I'm stuck with the same problem. Another issue I have is that I have two Firefox instance open with two different profiles and even without finicky the link is trying to open two different windows again withe default profile as reported in Bugzilla.

p-prakash avatar Jun 02 '20 09:06 p-prakash

Hi @p-prakash , unfortunately, no, I do not have a workaround at the moment, and thus I'm not using finicky any more as a consequence... which is sad as I like the tool. And this is an area where I'm not able to help further - apart from testing a new release and see if it works.

llange avatar Jun 02 '20 12:06 llange

Hi @p-prakash , @llange I don't know if I'm missing something with what you're intending to do, but I've managed to get Finicky to work with opening different Firefox Profiles by creating a new Firefox application in my applications folder called "WorkFirefox". (I did this by just renaming the Firefox.app in my Applications folder, and dragging a new version from the Firefox.dmg installer to create the two apps. The profiles are still all stored in the normal location: /Users/YourMacUsername/Library/Application Support/Firefox/Profiles/ )

I then assign my Work profile as the default in WorkFirefox.app, and assign my Personal profile as default in normal "Firefox.app" and use the recently added Finicky functionality for opening by application path e.g.

{match: ({ keys }) => keys.shift, browser: "/Applications/WorkFirefox.app"},
{match: ({ keys }) => keys.function, browser: "/Applications/Firefox.app"},

to open WorkFirefox with the shift key, and Firefox with the function key for example.

I don't know if this is would provide what you're looking for as a workaround?

jdnicholas avatar Jun 04 '20 12:06 jdnicholas

Hi Prakash P , unfortunately, no, I do not have a workaround at the moment, and thus I'm not using finicky any more as a consequence... which is sad as I like the tool. And this is an area where I'm not able to help further - apart from testing a new release and see if it works.

@llange if you change the browser in finicky to the absolute path of the app instead of the bundle it will work.

browser: "/Applications/Firefox-<customer1>.app"

I have the same setup of multiple Firefox "app"s running an exec script and the above works for me for each profile.

anmull avatar Jul 25 '20 02:07 anmull

Just an FYI: the "opening different Firefox Profiles by creating a new Firefox application" workaround does not work properly for me in the latest Big Sur public beta.

For example, when Firefox is already opened with "profile 2" active, and I launch an url assigned to this "profile 2", nothing happens. I do however see a second Firefox dock icon bouncing next to the Trash that doesn't open.

When i close Firefox, launching an url assigned to this "profile 2" does work though... 🤷🏼‍♂️

-- Finicky v3.1.1 (246)

notDavid avatar Oct 25 '20 11:10 notDavid

thanks @llange ! worked for me. but still would like to see it built-in ( since people do that anyway ). perf is approx same as brave/chrome

alex-popov-tech avatar Mar 30 '21 22:03 alex-popov-tech

This is solution which works for me (one Firefox, multiple profiles)

    browser: ({ urlString }) => ({
      name: "Firefox",
      args: ["-P", "nameOfWorkProfile", `${urlString}`],
    }),

kiblik avatar Apr 05 '23 18:04 kiblik