Using a Non-Safari, Non-Chrome Browser

Oh, nice! I'm always glad to learn more Applescript techniques.

Peter, I don't know what you mean by this. Could you please give us an example?

From the Preferences : Other Hidden Preferences user manual section:

You can set the AppleScript name of the Safari application, as well as the name of the Safari browser shown in applications:

defaults write com.stairways.keyboardmaestro.engine AppleScriptSafariBundleID "com.apple.SafariTechnologyPreview"
defaults write com.stairways.keyboardmaestro.engine BrowserSafariName "Safari Tech"

or

defaults write com.stairways.keyboardmaestro.engine AppleScriptSafariName "com.apple.Safari"

Similarly for Google Chrome:

defaults write com.stairways.keyboardmaestro.engine AppleScriptGoogleChromeBundleID "com.google.Chrome.canary"
defaults write com.stairways.keyboardmaestro.engine BrowserGoogleChromeName "Chrome Canary"

The AppleScript name is used in AppleScript's which control the respective browser in the form of tell app “”. Note that the Safari browser must still behave like Safari, and the Chrome browser must behave like Chrome, or the actions will not work. Do not bother trying to set them to Firefox or something like that as it will not work. All this allows you to do is select a specific version of Safari or Chrome respectively.

Peter, thanks for sharing/clarifying.
That at least gives any one who want to ONLY run Brave an option to do so, but at the expense of not having access to Google Chrome.

AFAIK, the scripting model of Brave Browser is identical to Google Chrome. If that is the case, I would hope the effort to change KM to support Brave would be minimal.

Please give this a closer look. There are many who have switched from Safari to Google Chrome because Chrome is faster, better UI, and more extensible (more browser extensions). However, many don't switch to Chrome because of Google's bad reputation on privacy.

Brave is

  • even faster than Google Chrome,
  • has the same scripting model
  • supports most, if not all, of Chrome extensions
  • but has NONE of the privacy issues of Google

Thanks.

What is the bundle ID of Brave?

I hadn’t heard of Brave before; it looks interesting, and if it’s reasonable for KBM to support it, that’d be great.

But if so, what about all the other Chromium-based browsers that folk use? Vivaldi is quite popular, for example (I use it), Edge, and Chromium itself? I think there are a bunch of others, too. And is Opera Chromium-based now? It’d be lovely if all these were supported, but I worry that it might be a time drain on Peter — on-goingly.

"com.brave.Browser"

Peter, when I try to read these defaults, I get an error:

$ defaults read com.stairways.keyboardmaestro.engine AppleScriptGoogleChromeBundleID
2019-05-09 12:45:26.600 defaults[1769:64516] 
The domain/default pair of (com.stairways.keyboardmaestro.engine, AppleScriptGoogleChromeBundleID) does not exist

In fact, when I just do a read without a key to get all defaults, it works, but there is no key for "AppleScriptGoogleChromeBundleID"

So if I set the defaults for Brave Browser, how do I restore to use Google Chrome?

I will add it as a potential match for the front browser tokens - as long as it behaves the same as Google Chrome, it should work. But I cannot test this.

1 Like

Like most preferences, they are unset normally, and when absent they default to their expected normal default behaviour. To delete a key, use:

defaults delete com.stairways.keyboardmaestro.engine AppleScriptGoogleChromeBundleID

Note that like read will read everything if you omit the key, delete will delete everything if you omit the key (I believe), so one should use caution when using defaults delete.

2 Likes

Unfortunately, this has no impact on the FrontBrowser Actions and Tokens.

Is there another hidden pref that will allow Brave Browser to be included in the FrontBrowser Actions and Tokens?

Does this include FrontBrowser Actions, like Javascript in FrontBrowser?

FYI, right after you provided us with the very useful FrontBrowser Actions/Tokens, I converted all of my Macros to take advantage of them, so my Macros work equally well with both Safari and Chrome.

Now, I'd very much like for Brave Browser to be included as a FrontBrowser.

Thanks.

No.

I believe so, yes.

Noted.

1 Like

I have made the search for front browser include the configured Apple/Chrome bundle IDs for the next version. Though it also searches for Brave, so it should be irrelevant anyway.

1 Like

Hey Peter,

These are the most prominent Chrome-based-browsers other than Google Chrome:

CHROMIUM-BASED-BROWSERS

Brave Browser			com.brave.Browser
Google Chrome Canary	com.google.Chrome.canary
Vivaldi					com.vivaldi.Vivaldi

All support Chrome's execute AppleScript command in the same way.

I request that all be included in Keyboard Maestro's Front-Browser actions.

Also – It would be really nice if there was a mechanism for users to add Bundle-ID's to those actions, so new compatible browsers could be added at need instead of waiting for an update to Keyboard Maestro.

-Chris

3 Likes

Noted.

2 Likes

Excellent, thanks. Worked beautifully.

Would it be possible to have Chromium matched by default as well? (AppleScriptGoogleChromeBundleID org.chromium.Chromium, BrowserGoogleChromeName Chromium.)

Thanks!

1 Like

Hey @Unikitty,

Not presently.

Hey Peter (@peternlewis ) – Let me reiterate my feature-request:

It would be fine if this was an expert preference.

It's inevitable that there will be more Chrome-based browsers, and there are already 7 viable ones – Google Chrome, Google Chrome Canary, Chromium, Brave Browser, Opera, Vivaldi, and Microsoft Edge.

There are also several Webkit-based browsers using the same sdef as Safari.

-Chris

I saw another thread where @peternlewis promised to add support for Brave browser
https://forum.keyboardmaestro.com/t/using-a-non-safari-non-chrome-browser/13712/15

but these days I'm using MS Edge browser on Mac for most business purposes, since it's Chromium-based (v77.0.235.5 specifically).

However, this does not appear to be supported for Tokens at all. Even on latest v9, Front Browser reports Safari because I have that running as well (even though it's nowhere near the front), and %ChromeTitle% and URL resolve to "Not Running". Can this Edge support be added please?

Does Microsoft Edge support the same AppleScript dictionary as Google Chrome?

1 Like