[module/github] Refresh on right click
This commit is contained in:
parent
b22356d52b
commit
30ea9e2e69
1 changed files with 6 additions and 2 deletions
|
@ -11,6 +11,7 @@ Parameters:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
import functools
|
||||||
import bumblebee.input
|
import bumblebee.input
|
||||||
import bumblebee.output
|
import bumblebee.output
|
||||||
import bumblebee.engine
|
import bumblebee.engine
|
||||||
|
@ -30,12 +31,15 @@ class Module(bumblebee.engine.Module):
|
||||||
self._nextcheck = 0
|
self._nextcheck = 0
|
||||||
engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE,
|
engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE,
|
||||||
cmd="x-www-browser https://github.com/notifications")
|
cmd="x-www-browser https://github.com/notifications")
|
||||||
|
immediate_update = functools.partial(self.update, immediate=True)
|
||||||
|
engine.input.register_callback(self, button=bumblebee.input.RIGHT_MOUSE,
|
||||||
|
cmd=immediate_update)
|
||||||
|
|
||||||
def github(self, _):
|
def github(self, _):
|
||||||
return str(self._count)
|
return str(self._count)
|
||||||
|
|
||||||
def update(self, widgets):
|
def update(self, _, immediate=False):
|
||||||
if self._nextcheck < int(time.time()):
|
if immediate or self._nextcheck < int(time.time()):
|
||||||
self._nextcheck = int(time.time()) + self._interval * 60
|
self._nextcheck = int(time.time()) + self._interval * 60
|
||||||
token = self.parameter("token", "")
|
token = self.parameter("token", "")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue