From f51ac2ce1fe8f67c1fdf69ca0f2b845730cc1950 Mon Sep 17 00:00:00 2001 From: Frank Etoundi Date: Tue, 27 Jun 2023 11:49:55 +0200 Subject: [PATCH] Adds Brave Browser for mac, linux and windows --- BrowserRefresh.py | 3 +++ linux/__init__.py | 4 ++++ mac/__init__.py | 3 +++ win/__init__.py | 6 ++++++ 4 files changed, 16 insertions(+) diff --git a/BrowserRefresh.py b/BrowserRefresh.py index 9fee847..fd8f495 100644 --- a/BrowserRefresh.py +++ b/BrowserRefresh.py @@ -79,3 +79,6 @@ def run(self, args, activate=True, if 'palemoon' in browsers and _os == 'Windows': refresher.palemoon() + + if 'brave' in browsers: + refresher.brave() diff --git a/linux/__init__.py b/linux/__init__.py index eaf4908..b74c42c 100644 --- a/linux/__init__.py +++ b/linux/__init__.py @@ -34,6 +34,10 @@ def ie(self): pass # except NotImplemented("IE support not implemented yet.") + def brave(self): + self.SendKeysToAllWindows('brave-browser', 'F5') + # except NotImplemented("brave support not implemented yet.") + def SendKeysToAllWindows(self, cls, key): "Sends the keystroke to all windows whose title matches the regex" diff --git a/mac/__init__.py b/mac/__init__.py index 83528ae..3fa0bf8 100644 --- a/mac/__init__.py +++ b/mac/__init__.py @@ -86,5 +86,8 @@ def opera(self): self._call_applescript(command) + def brave(self): + self._chrome("Brave Browser", "brave") + def _call_applescript(self, command): call(['osascript', '-e', command]) diff --git a/win/__init__.py b/win/__init__.py index 3423651..94a4e2d 100644 --- a/win/__init__.py +++ b/win/__init__.py @@ -69,6 +69,12 @@ def ie(self): except WindowNotFoundError: pass + def brave(self): + try: + self.SendKeysToAllWindows('.*Brave') + except WindowNotFoundError: + pass + def SendKeysToAllWindows(self, title_regex): "Sends the keystroke to all windows whose title matches the regex"