[core] Add input processing
Create infrastructure for input event handling and add i3bar event processing. For each event, callbacks can be registered in the input module. Modules and widgets both identify themselves using a unique ID (the module name for modules, a generated UUID for the widgets). This ID is then used for registering the callbacks. This is possible since both widgets and modules are statically allocated & do not change their IDs. Callback actions can be either callable Python objects (in which case the event is passed as parameter), or strings, in which case the string is interpreted as a shell command. see #23
This commit is contained in:
parent
fa30b9505b
commit
e72c25b0bc
10 changed files with 274 additions and 19 deletions
|
@ -11,6 +11,8 @@ class Module(bumblebee.engine.Module):
|
|||
bumblebee.output.Widget(full_text=self.utilization)
|
||||
)
|
||||
self._utilization = psutil.cpu_percent(percpu=False)
|
||||
engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE,
|
||||
cmd="gnome-system-monitor")
|
||||
|
||||
def utilization(self):
|
||||
return "{:05.02f}%".format(self._utilization)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue