johnste / finicky

A macOS app for customizing which browser to start
MIT License
3.67k stars 136 forks source link

Changing profile within the chrome browser #330

Open rdek opened 3 months ago

rdek commented 3 months ago

Hello, my problem only concerns the Chrome browser, I have several profiles configured on it and I would like the appropriate links to open in the appropriate profiles. Everything works fine until I want to open a link in Default profile, which should open in Profile 3. Unfortunately, this does not happen, the page opens in the profile from which I clicked the link. I would like to know if there are configuration options that will allow me to define the functionality as above.

My config file:

const job1 = {
  name: "Google Chrome",
  profile: "Profile 3",
};

const job2 = {
  name: "Google Chrome",
  profile: "Default",
};

const private = {
  name: "Google Chrome",
  profile: "Profile 7",
};

const outlookApp = "/Applications/Microsoft Outlook.app";

module.exports = {
  defaultBrowser: "Google Chrome",      
  handlers: [
    {
      match: [
        /^https?:\/\/job1\.sharepoint\.com\.goskope\.com\/.*$/,
        /^https:\/\/jira\-job1\-ds\.atlassian\.net\/$/,
      ],  
      browser: job1,
      },
    {
      match: /^https?:\/\/facebook\.com\/.*$/,
      browser: private,
      },
    {
      match: /^https:\/\/job2\.sharepoint\.com\/$/,
      browser: job2,
    },
    {
      match: ({ opener }) => ["Microsoft Outlook"].includes(opener.name),
      browser: job2,
    },
    {
      match: finicky.matchDomains("open.spotify.com"),
      browser: "Spotify"
    },
    {
      match: finicky.matchHostnames(['teams.microsoft.com']),
      browser: 'com.microsoft.teams',
      url: ({url}) =>
          ({...url, protocol: 'msteams'}),
    },
  ]
}

Thanks!

dkroehan commented 2 months ago

I do experience the same issue with Chrome on MacOS.

I do have my gmail tab open in Profile 1 and if I click on a link in an email that is configured to be opened in Profile 2 it still opens in Profile 1. If I click the exact same link from another application it works just fine.

jamtur01 commented 1 month ago

I solved this by writing a Chrome extension - which is probably not overly elegant - but seems to work:

https://github.com/jamtur01/finicky-chrome-integration