openwith icon indicating copy to clipboard operation
openwith copied to clipboard

Add support for Brave Browser

Open ryanthomas-org opened this issue 5 years ago • 5 comments

I managed to get this working in brave by installing from the Chrome Web Store, then adding the following to line 66 (under "def install()" and "locations") of open_with_linux.py:

'brave': os.path.join(home_path, '.config', 'BraveSoftware', 'Brave-Browser-Dev', 'NativeMessagingHosts'),

For a while I was trying to use: 'brave': os.path.join(home_path, '.config', 'brave', 'NativeMessagingHosts'),

For some reason on my system, both ~/.config/brave/NativeMessagingHosts and ~/.config/BraveSoftware/Brave-Browser-Dev/NativeMessagingHosts exist, but it was the latter that worked.

My Brave installation is a bit of a mystery to me these days, in that I generally launch Brave via the binary brave-browser-dev but brave-browser seems to load the same configuration, so it took a while before it even occurred to me to look for an alternate config path. You might want to account for both.

For purposes of adding a searchable paper trail to help others get here, with open_with.json installed in the wrong place, when I pressed Test Installation button in options.html, my Browser Console was yielding

options.html:1 Unchecked runtime.lastError: Specified native messaging host not found.

Anyway, thank you for this awesome tool! I can't wait to tie it to some scripts ;)

addBraveSupport.patch.txt

ryanthomas-org avatar Nov 16 '19 22:11 ryanthomas-org

Seconded. Please add Brave to the auto-detected browsers.

Meanwhile, a workaround is: duplicate another browser's entry, then modify the name and path. For the image, a take manually downloaded picture.

noyannus avatar Dec 31 '19 14:12 noyannus

Orientation

Four files at https://github.com/darktrojan/openwith/tree/master/webextension/native

  • https://github.com/darktrojan/openwith/blob/master/webextension/native/open_with_linux.py
  • https://github.com/darktrojan/openwith/blob/master/webextension/native/open_with_mac.py
  • https://github.com/darktrojan/openwith/blob/master/webextension/native/open_with_windows.ps1
  • https://github.com/darktrojan/openwith/blob/master/webextension/native/open_with_windows.py

Collaboration

From https://github.com/darktrojan/openwith/issues/256#issuecomment-590142501:

Optimistically: a single PR at https://github.com/darktrojan/openwith/pulls might add support for both Waterfox Current and Brave.

tl;dr Waterfox Current is based on Firefox ESR 68.

Content of the patch from https://github.com/darktrojan/openwith/issues/250#issue-523902946 above:

--- open_with_linux.bak.py	2019-11-16 15:21:01.764783997 -0600
+++ open_with_linux.py	2019-11-16 15:49:57.092113557 -0600
@@ -63,6 +63,7 @@
 	}
 	locations = {
 		'chrome': os.path.join(home_path, '.config', 'google-chrome', 'NativeMessagingHosts'),
+		'brave': os.path.join(home_path, '.config', 'BraveSoftware', 'Brave-Browser-Dev', 'NativeMessagingHosts'),
 		'chromium': os.path.join(home_path, '.config', 'chromium', 'NativeMessagingHosts'),
 		'firefox': os.path.join(home_path, '.mozilla', 'native-messaging-hosts'),
 	}
@@ -114,6 +115,9 @@
 	apps = [
 		'Chrome',
 		'Chromium',
+		'brave',
+		'brave-browser',
+		'brave-browser-dev',
 		'chromium-browser',
 		'firefox',
 		'Firefox',

grahamperrin avatar Feb 24 '20 02:02 grahamperrin

@hawkeye116477 please: before I progress this draft PR, does https://github.com/darktrojan/openwith/pull/260/files#diff-7bc853bec8fdb46c84c8314eae9ed494R131 look reasonable to you?

TIA

grahamperrin avatar Mar 01 '20 17:03 grahamperrin

@grahamperrin I'm not sure, but maybe you should also add waterfox-current to Apps array.

hawkeye116477 avatar Mar 01 '20 17:03 hawkeye116477

@grahamperrin Hi, I tried your modifications from your 7510cb2 commit, but it didn't do anything.

I had to replace Brave-Browser-Dev by Brave-Browser for the script to work :

$ ls -ld ~/.config/BraveSoftware/Brave-Browser-Dev
ls: cannot access /home/abcdxyzt/.config/BraveSoftware/Brave-Browser-Dev: No such file or directory
$ ls -ld ~/.config/BraveSoftware/Brave-Browser
drwx------ 1 abcdxyzt abcdxyzt 1056 mars  14 02:36 /home/abcdxyzt/.config/BraveSoftware/Brave-Browser/

sebma avatar Mar 14 '20 01:03 sebma