~earboxer/browset

88eac6043213185757075b6d182d5398ac412031 — Zach DeCook 1 year, 1 month ago 92875ee
Commands: Add external open
1 files changed, 6 insertions(+), 0 deletions(-)

M browset.py
M browset.py => browset.py +6 -0
@@ 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)