b0608c7054
Add a module that retrieve mute status and volume (left, right, mono) from pulseaudio. Unfortunately, this module is really, really hacky. It invokes "pactl" multiple times to get the status and does some ugly parsing on the output. Overall, this is pretty brittle and prone to failure, but as I was not able to find a decent pulseaudio library for Python... Probably, I haven't searched hard enough, cannot believe such a thing does not exist.
17 lines
441 B
Python
17 lines
441 B
Python
import datetime
|
|
import bumblebee.module
|
|
|
|
class Module(bumblebee.module.Module):
|
|
def __init__(self, args):
|
|
super(Module, self).__init__(args)
|
|
|
|
module = self.__module__.split(".")[-1]
|
|
|
|
default = "%x" if module == "date" else "%X"
|
|
self._fmt = args[0] if args else default
|
|
|
|
|
|
def data(self):
|
|
return datetime.datetime.now().strftime(self._fmt)
|
|
|
|
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|