Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Firefox profiles #90

Open
llange opened this issue Dec 9, 2019 · 11 comments
Open

Support for Firefox profiles #90

llange opened this issue Dec 9, 2019 · 11 comments

Comments

@llange
Copy link

llange commented Dec 9, 2019

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 !

@ldub
Copy link
Contributor

ldub commented Feb 2, 2020

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

@llange
Copy link
Author

llange commented Feb 2, 2020

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...

@ldub
Copy link
Contributor

ldub commented Feb 2, 2020

As I mentioned here #40 (comment) , 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.

@p-prakash
Copy link

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.

@llange
Copy link
Author

llange commented Jun 2, 2020

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.

@jdnicholas
Copy link

jdnicholas commented Jun 4, 2020

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?

@anmull
Copy link

anmull commented Jul 25, 2020

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.

@notDavid
Copy link

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)

@alex-popov-tech
Copy link

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

@kiblik
Copy link

kiblik commented Apr 5, 2023

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

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

@sourcecodemage
Copy link

sourcecodemage commented Apr 9, 2024

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

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

Where would these line inside of .finicky.js?

I currently have the example file , and would like to add your solution to it

module.exports = {
    defaultBrowser: "Google Chrome",
    rewrite: [
      {
        // Redirect all urls to use https
        match: ({ url }) => url.protocol === "http",
        url: { protocol: "https" }
      }
    ],
    handlers: [
      {
        // Open apple.com and example.com urls in Safari
        match: finicky.matchHostnames(["apple.com", "example.com"]),
        browser: "Safari"
      },
      {
        // Open any url that includes the string "workplace" in Firefox
        match: /workplace/,
        browser: "Firefox"
      },
      {
        // Open google.com and *.google.com urls in Google Chrome
        match: [
          "google.com/*", // match google.com urls
          "*.google.com/*", // match google.com subdomains
        ],
        browser: "Google Chrome"
      }
    ]
  };

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants