[modules] Allow modules to provide default click actions

Pass the "output" object to the modules' constructor to allow them to
define their own callbacks.
Any user-provided callbacks take precedence and override those of the
module.
This commit is contained in:
Tobias Witek 2016-11-01 08:09:10 +01:00
parent 63e041259f
commit fca3171556
11 changed files with 20 additions and 15 deletions

View file

@ -12,10 +12,13 @@ def description():
return "Shows free diskspace, total diskspace and the percentage of free disk space."
class Module(bumblebee.module.Module):
def __init__(self, args):
def __init__(self, output, args):
super(Module, self).__init__(args)
self._path = args[0] if args else "/"
output.add_callback(module=self.__module__,
button=1, cmd="nautilus {instance}")
def data(self):
st = os.statvfs(self._path)