X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/52deb6911957f840a0191f73c8a9626bd9ff5086..554d206f5fbc1e04e8863b07b7e2448163857050:/widgets/alsabar.lua?ds=sidebyside diff --git a/widgets/alsabar.lua b/widgets/alsabar.lua index f504cc0..c7498d2 100644 --- a/widgets/alsabar.lua +++ b/widgets/alsabar.lua @@ -8,12 +8,12 @@ --]] local newtimer = require("lain.helpers").newtimer +local read_pipe = require("lain.helpers").read_pipe local awful = require("awful") local beautiful = require("beautiful") local naughty = require("naughty") -local io = { popen = io.popen } local math = { modf = math.modf } local mouse = mouse local string = { format = string.format, @@ -122,9 +122,7 @@ local function worker(args) function alsabar.update() -- Get mixer control contents - local f = assert(io.popen(string.format("%s get %s", alsabar.cmd, alsabar.channel))) - local mixer = f:read("*all") - f:close() + local mixer = read_pipe(string.format("%s get %s", alsabar.cmd, alsabar.channel)) -- Capture mixer control state: [5%] ... ... [on] local volu, mute = string.match(mixer, "([%d]+)%%.*%[([%l]*)")