[modules/github] Use xdg-open, if available
This commit is contained in:
parent
3bb7cf51ec
commit
f573407b11
1 changed files with 7 additions and 1 deletions
|
@ -10,6 +10,7 @@ Parameters:
|
||||||
* github.interval: Interval in minutes between updates, default is 5.
|
* github.interval: Interval in minutes between updates, default is 5.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import shutil
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
import core.module
|
import core.module
|
||||||
|
@ -26,8 +27,13 @@ class Module(core.module.Module):
|
||||||
self.__requests = requests.Session()
|
self.__requests = requests.Session()
|
||||||
self.__requests.headers.update({'Authorization':'token {}'.format(self.parameter('token', ''))})
|
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,
|
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)
|
core.input.register(self, button=core.input.RIGHT_MOUSE, cmd=self.update)
|
||||||
|
|
||||||
def github(self, _):
|
def github(self, _):
|
||||||
|
|
Loading…
Reference in a new issue