Using a Non-Safari, Non-Chrome Browser

I was not aware of the Brave Browser. It looks very interesting.

There are some unpleasant things about it (its optional ad exchange program and monetization thereof look sleazy at a quick view, but it's optional), but boy howdy is it ever fast. So I'm giving it a try, and in the process reworking my browser macros to work with any browser, not just my previous default of Chrome. And learning things along the way :sweat_smile: (It would certainly be great if "Front Browser" actually meant front browser, not just "whichever of Chrome and Safari was last used"!)

Probably not, not unless it becomes more popular. Although you should be able to use the existing preferences for Google browser settings to point at it.

You could also just do it via AppleScript:

tell application "Brave Browser" to open location "https://www.google.com/search?q=\"Mary Had A Little Lamb\""

or, using the clipboard content:

tell application "Brave Browser" to open location "https://www.google.com/search?q=\"" & (the clipboard as text) & "\""

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