[modules/pulseaudio] Show bar charts

Re-enable optional display of barcharts
This commit is contained in:
Tobias Witek 2020-02-23 13:59:47 +01:00
parent b2064142d0
commit 66bdfacf6f
2 changed files with 15 additions and 13 deletions

View file

@ -20,6 +20,7 @@
- WAL support
- tkinter / popups
- scrolling decorator (incl. minwidth, alignment)
- states
## Improvements
- pango output (improve - maybe autodetect? see #531)

View file

@ -25,8 +25,9 @@ import core.module
import core.widget
import core.input
import util.format
import util.cli
import util.graph
import util.format
class Module(core.module.Module):
def __init__(self, config, channel):
@ -44,7 +45,7 @@ class Module(core.module.Module):
self._mute = False
self._failed = False
self._channel = channel
#self._showbars = core.fmt.bool(self.parameter('showbars', 0))
self._showbars = util.format.asbool(self.parameter('showbars', 0))
self._patterns = [
{'expr': 'Name:', 'callback': (lambda line: False)},
@ -117,23 +118,23 @@ class Module(core.module.Module):
return 'n/a'
if int(self._mono) > 0:
vol = '{}%'.format(self._mono)
#if self._showbars:
# vol = '{} {}'.format(
# vol, bumblebee.output.hbar(float(self._mono)))
if self._showbars:
vol = '{} {}'.format(
vol, util.graph.hbar(float(self._mono)))
return vol
elif self._left == self._right:
vol = '{}%'.format(self._left)
#if self._showbars:
# vol = '{} {}'.format(
# vol, bumblebee.output.hbar(float(self._left)))
if self._showbars:
vol = '{} {}'.format(
vol, util.graph.hbar(float(self._left)))
return vol
else:
#if self._showbars:
# vol = '{} {}{}'.format(
# vol,
# bumblebee.output.hbar(float(self._left)),
# bumblebee.output.hbar(float(self._right)))
vol = '{}%/{}%'.format(self._left, self._right)
if self._showbars:
vol = '{} {}{}'.format(
vol,
util.graph.hbar(float(self._left)),
util.graph.hbar(float(self._right)))
return vol
def update(self):