[modules/cmus] Add controls for cmus (next/prev/shuffle/repeat)

Add controls that allow the user to switch to the next and previous song
in cmus, toggle shuffle and repeat. Pause/play is toggled by clicking on
the song title itself.

fixes #5
This commit is contained in:
Tobi-wan Kenobi 2016-11-12 12:11:42 +01:00
parent a33cb1d7cb
commit dead54ed1f
7 changed files with 82 additions and 7 deletions

View file

@ -9,10 +9,11 @@ def output(args):
return bumblebee.outputs.i3.Output(args)
class Widget(object):
def __init__(self, obj, text):
def __init__(self, obj, text, instance=None):
self._obj = obj
self._text = text
self._store = {}
self._instance = instance
def set(self, key, value):
self._store[key] = value
@ -33,7 +34,7 @@ class Widget(object):
return self._obj.__module__.split(".")[-1]
def instance(self):
return getattr(self._obj, "instance")(self)
return self._instance if self._instance else getattr(self._obj, "instance")(self)
def text(self):
return self._text