darktrojan / openwith

Open With add-on for Firefox
https://addons.mozilla.org/addon/open-with/
412 stars 71 forks source link

Add support for Brave Browser #250

Open ryanthomas-org opened 5 years ago

ryanthomas-org commented 5 years ago

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

noyannus commented 4 years ago

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.

grahamperrin commented 4 years ago

Orientation

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

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 commented 4 years ago

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

TIA

hawkeye116477 commented 4 years ago

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

sebma commented 4 years ago

@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/