1 -- Authors: Benjamin Sigonneau
2 -- License: Public domain
3 -- Last Changed: Unknown
5 -- Public domain, written by Benjamin Sigonneau
6 -- Allows displaying volume information in the statusbar.
8 -- add some of the following fields into your template in cfg_statusbar.lua:
12 local unknown
= "??", "??"
14 local function get_volume()
15 local f
=io
.popen('aumix -q','r')
16 local s
=f
:read('*all')
18 local _
, _
, master
, pcm
=
19 string.find(s
, "vol[0-9]? (%d*), .*\n"..
20 "pcm[0-9]? (%d*), .*\n"
29 return master
.."%", pcm
.."%"
33 local function inform(key
, value
)
34 statusd
.inform("volume_"..key
, value
)
38 local volume_timer
= statusd
.create_timer()
40 local function update_volume()
41 local master
, pcm
= get_volume()
42 inform("master", master
)
44 -- update every 10 seconds
45 volume_timer
:set(10*1000, update_volume
)