[module/output] Re-enable user configurable mouse click events
This is now much nicer implemented to address issue #3. A user can now have a configuration parameter mapped to a module instance (via the module name or the instance name) with the value "left-click", "right-click", etc., like this: -m disk:home -p home.left-click="nautilus {instance}"
This commit is contained in:
parent
26f5fd3064
commit
67142d642b
2 changed files with 17 additions and 0 deletions
|
@ -39,6 +39,21 @@ class Module(object):
|
||||||
name = "{}.".format(alias if alias else self.__module__.split(".")[-1])
|
name = "{}.".format(alias if alias else self.__module__.split(".")[-1])
|
||||||
self._config = bumblebee.config.ModuleConfig(config, name)
|
self._config = bumblebee.config.ModuleConfig(config, name)
|
||||||
|
|
||||||
|
buttons = [
|
||||||
|
{ "name": "left-click", "id": 1 },
|
||||||
|
{ "name": "middle-click", "id": 2 },
|
||||||
|
{ "name": "right-click", "id": 3 },
|
||||||
|
{ "name": "wheel-up", "id": 4 },
|
||||||
|
{ "name": "wheel-down", "id": 5 },
|
||||||
|
]
|
||||||
|
for button in buttons:
|
||||||
|
if self._config.parameter(button["name"], None):
|
||||||
|
output.add_callback(
|
||||||
|
module=self.instance(),
|
||||||
|
button=button["id"],
|
||||||
|
cmd=self._config.parameter(button["name"])
|
||||||
|
)
|
||||||
|
|
||||||
def critical(self, widget):
|
def critical(self, widget):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,8 @@ class Output(object):
|
||||||
if module:
|
if module:
|
||||||
module = module.replace("bumblebee.modules.", "")
|
module = module.replace("bumblebee.modules.", "")
|
||||||
|
|
||||||
|
if self._callbacks.get((button, module)): return
|
||||||
|
|
||||||
self._callbacks[(
|
self._callbacks[(
|
||||||
button,
|
button,
|
||||||
module,
|
module,
|
||||||
|
|
Loading…
Reference in a new issue