[modules/cmus] Add mouse controls

Enable play/pause, repeat/shuffle toggle, next/prev song by clicking on
the various elements in the bar.

see #23
This commit is contained in:
Tobi-wan Kenobi 2016-12-10 08:19:24 +01:00
parent 1a3217bb5f
commit b1ec41f905

View file

@ -21,6 +21,18 @@ class Module(bumblebee.engine.Module):
bumblebee.output.Widget(name="cmus.repeat"),
]
super(Module, self).__init__(engine, config, widgets)
engine.input.register_callback(widgets[0], button=bumblebee.input.LEFT_MOUSE,
cmd="cmus-remote -r")
engine.input.register_callback(widgets[1], button=bumblebee.input.LEFT_MOUSE,
cmd="cmus-remote -u")
engine.input.register_callback(widgets[2], button=bumblebee.input.LEFT_MOUSE,
cmd="cmus-remote -n")
engine.input.register_callback(widgets[3], button=bumblebee.input.LEFT_MOUSE,
cmd="cmus-remote -S")
engine.input.register_callback(widgets[4], button=bumblebee.input.LEFT_MOUSE,
cmd="cmus-remote -R")
self._fmt = self.parameter("format", "{artist} - {title} {position}/{duration}")
self._status = None
self._shuffle = False