media_control.lua: fix isMuted function not working on some devices

This commit is contained in:
Alice Gaudon 2020-04-12 14:59:17 +02:00
parent f56403f0bf
commit 97e8188a1a

View File

@ -43,7 +43,7 @@ end
function isMuted()
local handle = io.popen("amixer " .. config.audio.card .. " sget '" .. config.audio.device .. "' | egrep 'Playback.*?\\[o' | egrep -o '\\[o.+\\]'", "r")
local muted = string.gsub(handle:read("*a"), "[\n]+", "") == "[off]"
local muted = string.match(string.gsub(handle:read("*a"), "[\n]+", ""), "off")
handle:close()
return muted
end