Browser actions with two instances of Google Chrome

For my work environment I need to use two instances of Google Chrome at the same time with a different set of preferences. This is the terminal command I run:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --user-data-dir=/Users/~/Documents/Chrome-alt

After this command I have two separate Chrome apps open simultaneously, I have two instances in the app switcher and in the dock, both called with the same name "Google Chrome". With my macros I don't need to jump from one browser to the other, but I only need to run the macro in the Chrome instance I have active in the moment I trigger the macro, or in the last web browser that was frontmost.

I hoped I could use the Front Browser actions and it would detect the frontmost Chrome instance but it doesn't work that way. All KM browser actions run in the second instance of Chrome, it doesn't matter if I use the Front Browser or Google Chrome actions.

The only action currently working as expected is the "Activate a Specific Application" action. After I selected in the dropdown menu Google Chrome (I can only see one in the list), it always brings up the frontmost instance of the app, depending which one I last used.

Any idea? That would be really appreciated.
Thanks

Yes, I'm afraid while Keyboard Maestro supports multiple different web browsers, the AppleScript it uses is based on the bundle id of the selected browser, which cannot differentiate between your two browsers in this case.

I'm not even sure how the AppleScript would differentiate between them given they have the same name, bundleid and path.

I don't really have a solution for you for this usage. You'll need to resort to using AppleScript yourself and specifically targeting the respective browsers somehow.

1 Like

Could you duplicate the "Google Chrome.app" into another folder/file called Google Chrome2.app? In that case, the app name would be different.

I wish it was that easy. If you do that and you open the duplicated app, it just opens a new window in the same browser. Same thing running open -n -a "/Applications/Google Chrome.app/" in Terminal. :sleepy:

Why not try using "Chromium" as your "second Chrome browser." It's quite similar.

You did ask for "ideas."

Indeed, I did ask for ideas and I appreciate you help. Actually this is a good one. I could also use Chrome Canary? I wonder if it's more stable Canary or Chromium for work usage?

I have no idea. I wouldn't install Chrome on my Mac. Too many bad experiences.