Any Plans to Fix Brave Compatibility?

For all I know, this is something that can't be fixed on the KM end, but I was wondering if @peternlewis could let us know the state of affairs with Brave Browser...? If the answer is, "nothing can be done", that's fine; I can start using a different browser. Just be nice to know.

A few things that haven't worked for a few months now:

  • Set/get tab number
  • Found image in Front Window
  • Wait for Brave Browser to Finish Loading

There are a bunch of actions I never use, so I can't confirm if they're working or not, but these three are enough to mean Brave isn't really usable with KM. There's a workaround for finding images in the front window, but it would be nice if it just worked.

I’m like 90% sure that #1 and #3 do work (I’m not at my mac atm). Have you got an example macro where they don’t work?

Interesting. I tested them before posting to try to avert an egg-on-face moment but they definitely don't work. I'm on Monterey and Brave is up to date. Same for you?

As far as I recall, Brave does not support the requisite AppleScript abilities, and until that happens that actions cannot be implemented in Keyboard Maestro - you can potentially try to UI control Brave, but that is not something that could be done robustly enough to implement in the native actions.

1 Like

I can get the current tab number with:

tell application "Brave Browser"
	get the active tab index of the front window
end tell

...and go to a tab by its number with:

tell application "Brave Browser"
	set the active tab index of the front window to <Number>
end tell

I can wait till the current tab has finished loading with:

tell application "Brave Browser"
	set TabNum to the active tab index of the front window
	repeat until (loading of tab TabNum of window 1 is false)
	end repeat
	loading of tab TabNum of window 1
end tell

If KM relies on AS, and AS can do this, it seems odd that KM can't.

Based on this, and @vincent_ardern's confidence, perhaps something's wrong with my configuration.

I've run:

defaults write com.stairways.keyboardmaestro.engine BrowserGoogleChromeName "Brave Browser"

defaults write com.stairways.keyboardmaestro.engine AppleScriptGoogleChromeName "Brave Browser"

...and I've turned on View -> Developer -> Allow Javascript from Apple Events.

Have I missed anything?

I had a quick try yesterday using the "Front Browser Control" actions and Brave seemed OK. Perhaps try some of those instead (I guess you're using "Chrome Control" currently?) for another data point.

1 Like

And once again, you save my bacon (never understood that expression!).

I wonder why the Brave-specific actions stopped working lately. Clearly something's amiss and I wonder if this might give us a clue how to get the front window stuff working again? It's a bit of a pain to have to do this every time you want to find an image in Brave:

Do you need to repoint Chrome actions/tokens/functions to Brave? What do they do that the FrontBrowser versions don't?

You may be ahead of the Wiki, or just using variant commands, but try using explicit strings and bundle IDs as the Wiki suggests:

defaults write com.stairways.keyboardmaestro.engine AppleScriptGoogleChromeBundleID -string "com.brave.Browser"
defaults write com.stairways.keyboardmaestro.engine BrowserGoogleChromeName -string "Brave Browser"

For your example, do you mean the inability to constrain image detection to "Front Window"? I couldn't get that to work either (though I'm likely doing something wrong) although, weirdly, this does work:

I haven't a clue what the difference is between "Frontmost Window" in the action and "frontmost window of frontmost app" in the function -- but it appears there is one!

1 Like

Nothing! They just have the word "Brave" and a pretty logo on them.

Dayumm.. I could have sworn I'd copied and pasted them. Either the Wiki's been updated, I copied them from a misquoted thread, or... A glitch in the Matrix?

You've fixed the Brave actions for me! Right, now about that found image thing...


That is weird. Simplifies things somewhat, at least.

Perhaps @peternlewis can enlighten us?

This is working for us.

I put you wrong sorry. I use the front browser actions, not the Chrome/Brave actions. I sometimes try to use Safari for a bit (hasn’t stuck yet), hence using front browser by default.

1 Like

If Brave uses the same AppleScript as chrome, then it can be configured as a Chrome-style browser and will work with the browser actions.

@peternlewis, the only missing piece of the puzzle is...

Keyboard Maestro clearly can search Brave's front window for images, so I'm wondering if there's a tweak that would make it work straight out of the box...?