diff options
| author | Zach DeCook <zachdecook@librem.one> | 2023-01-11 12:25:11 -0500 |
|---|---|---|
| committer | Zach DeCook <zachdecook@librem.one> | 2023-01-11 12:25:11 -0500 |
| commit | d236dd91d458035a455a4fa4f198aa1fb0e7fad9 (patch) | |
| tree | 5940112a3a8ed9a10c3b3f7d00626565ef25ff34 /browset.py | |
| parent | 50c38b6113214a9c29ba870f16adda29ed95c317 (diff) | |
| download | browset-d236dd91d458035a455a4fa4f198aa1fb0e7fad9.tar.gz | |
Bindings: Bind back and soon
Diffstat (limited to 'browset.py')
| -rwxr-xr-x | browset.py | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/browset.py b/browset.py index 739e894..5fb365e 100755 --- a/browset.py +++ b/browset.py @@ -11,7 +11,9 @@ class Browset(App): url = "" CSS_PATH = "browset.css" BINDINGS = [ - Binding("ctrl+c,ctrl+q", "app.quit", "Quit", show=True), + Binding("ctrl+q,ctrl+c", "app.quit", "Quit", show=True), + Binding("ctrl+left", "back()", "Back", show=False), + Binding("ctrl+right", "soon()", "Soon", show=False), ] history = [] fistory = [] # forward history @@ -37,20 +39,25 @@ class Browset(App): if event.button.name == 'refresh': self._do_url(self.url) elif event.button.name == 'back': - if len(self.history): - self.fistory.append(self.url) - url = self.history.pop() - self._do_url(url, histore=False, clearF=False) + self.action_back() elif event.button.name == 'soon': - if len(self.fistory): - url = self.fistory.pop() - self._do_url(url, clearF=False) + self.action_soon() else: url = event.button.name if not ":" in url: url = GeminiProtocol.relativeURL(url, self.url) self._do_url(url) - + + def action_back(self): + if len(self.history): + self.fistory.append(self.url) + url = self.history.pop() + self._do_url(url, histore=False, clearF=False) + def action_soon(self): + if len(self.fistory): + url = self.fistory.pop() + self._do_url(url, clearF=False) + def _do_url(self, url, histore=True, setbar=True, clearF=True): if clearF: self.fistory = [] |
