pulse: db as int, add docs
This commit is contained in:
parent
c841736eac
commit
b179a55d28
@ -6,11 +6,13 @@ class PulseAudio(Module):
|
||||
"""
|
||||
Shows volume of default PulseAudio sink (output).
|
||||
|
||||
Requires libpulseaudio from PyPI. Based on http://freshfoo.com/blog/pulseaudio_monitoring
|
||||
Available formatters:
|
||||
* `{volume}` — volume in percent (0...100)
|
||||
* `{db}` — volume in decibels relative to 100 %, i.e. 100 % = 0 dB, 50 % = -18 dB, 0 % = -infinity dB
|
||||
"""
|
||||
|
||||
settings = (
|
||||
("format", "{volume} is the current volume"),
|
||||
"format"
|
||||
)
|
||||
|
||||
format = "♪: {volume}"
|
||||
@ -75,7 +77,7 @@ class PulseAudio(Module):
|
||||
if sink_info_p:
|
||||
sink_info = sink_info_p.contents
|
||||
volume_percent = int(100 * sink_info.volume.values[0]/0x10000)
|
||||
volume_db = pa_sw_volume_to_dB(sink_info.volume.values[0])
|
||||
volume_db = int(pa_sw_volume_to_dB(sink_info.volume.values[0]))
|
||||
|
||||
self.output = {
|
||||
"full_text": self.format.format(volume=volume_percent, db=volume_db),
|
||||
|
Loading…
Reference in New Issue
Block a user