From f573407b112fe2d9e5cc744fa918511621924575 Mon Sep 17 00:00:00 2001 From: tobi-wan-kenobi Date: Thu, 23 Apr 2020 12:59:08 +0200 Subject: [PATCH] [modules/github] Use xdg-open, if available --- modules/contrib/github.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/contrib/github.py b/modules/contrib/github.py index 0d5520f..f995ce5 100644 --- a/modules/contrib/github.py +++ b/modules/contrib/github.py @@ -10,6 +10,7 @@ Parameters: * github.interval: Interval in minutes between updates, default is 5. """ +import shutil import requests import core.module @@ -26,8 +27,13 @@ class Module(core.module.Module): self.__requests = requests.Session() self.__requests.headers.update({'Authorization':'token {}'.format(self.parameter('token', ''))}) + cmd = 'xdg-open' + if not shutil.which(cmd): + cmd = 'x-www-browser' + + core.input.register(self, button=core.input.LEFT_MOUSE, - cmd='x-www-browser https://github.com/notifications') + cmd='{} https://github.com/notifications'.format(cmd)) core.input.register(self, button=core.input.RIGHT_MOUSE, cmd=self.update) def github(self, _):