Broken project to implement a cross-protocol browser in textual
Commands: Add external open
Zach DeCook 2023-01-28
parent 92875ee · commit 88eac60
-rwxr-xr-xbrowset.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/browset.py b/browset.py
index bf76aa3..3c01c29 100755
--- a/browset.py
+++ b/browset.py
@@ -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)