Broken project to implement a cross-protocol browser in textual
Commands: Add external open
| -rwxr-xr-x | browset.py | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -11,6 +11,7 @@ from protocol.gemini import GeminiProtocol from protocol.data import DataProtocol from protocol.http import HttpProtocol from protocol.about import AboutProtocol +from subprocess import Popen, DEVNULL protocols = { "gemini": GeminiProtocol, @@ -27,6 +28,7 @@ class Browset(App): Binding("ctrl+q,ctrl+c", "app.quit", "Quit", show=True), Binding("ctrl+left", "back()", "Back", show=False), Binding("ctrl+right", "soon()", "Soon", show=False), + Binding("ctrl+o", "external_open()", "Open Externally"), ] history = [] fistory = [] # forward history @@ -69,6 +71,10 @@ class Browset(App): else: toolbar.remove_class('mobile') + def action_external_open(self): + # Run this command in the background + Popen(["xdg-open", self.url], stdout=DEVNULL, stderr=DEVNULL) + def action_back(self): if len(self.history): self.fistory.append(self.url) |