X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/6cc550655fad64e784ff87916f3ef439ebaf4c4a..9f6c36adbae22c35ccb779254ddb967c1f5e547d:/widgets/alsa.lua diff --git a/widgets/alsa.lua b/widgets/alsa.lua index 28bb05c..5a4335e 100644 --- a/widgets/alsa.lua +++ b/widgets/alsa.lua @@ -12,7 +12,8 @@ local newtimer = require("lain.helpers").newtimer local wibox = require("wibox") local io = { popen = io.popen } -local string = { match = string.match } +local string = { match = string.match, + format = string.format } local setmetatable = setmetatable @@ -22,6 +23,7 @@ local alsa = {} local function worker(args) local args = args or {} + local card = args.card or "0" local timeout = args.timeout or 5 local channel = args.channel or "Master" local settings = args.settings or function() end @@ -29,8 +31,8 @@ local function worker(args) alsa.widget = wibox.widget.textbox('') function alsa.update() - local f = assert(io.popen('amixer get ' .. channel)) - local mixer = f:read("*all") + local f = assert(io.popen(string.format("amixer -c %s -M get %s", card, channel))) + local mixer = f:read("*a") f:close() volume_now = {}