From c3d2ef5f0bd08a79383e0dbbed7edb1803f373f2 Mon Sep 17 00:00:00 2001 From: tobi-wan-kenobi Date: Thu, 23 Apr 2020 07:48:23 +0200 Subject: [PATCH] [modules/github] Use xdg-open by default Use xdg-open to open the URL, and fall back to x-www-browser, if xdg-open is not available. fixes #600 --- bumblebee/modules/github.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bumblebee/modules/github.py b/bumblebee/modules/github.py index 3a3d097..c28cfc2 100644 --- a/bumblebee/modules/github.py +++ b/bumblebee/modules/github.py @@ -14,6 +14,8 @@ import bumblebee.input import bumblebee.output import bumblebee.engine +import bumblebee.util + try: import requests except ImportError: @@ -28,9 +30,13 @@ class Module(bumblebee.engine.Module): self.interval_factor(60) self.interval(5) self._requests = requests.Session() + + cmd = "xdg-open" + if not bumblebee.util.which(cmd): + cmd = "x-www-browser" self._requests.headers.update({"Authorization":"token {}".format(self.parameter("token", ""))}) engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE, - cmd="x-www-browser https://github.com/notifications") + cmd="{} https://github.com/notifications".format(cmd)) engine.input.register_callback(self, button=bumblebee.input.RIGHT_MOUSE, cmd=self.update) def github(self, _):