alsabar: forgot callback

This commit is contained in:
copycat-killer 2017-01-23 15:52:26 +01:00
parent 5383f3db0d
commit ff61857e15
1 changed files with 4 additions and 1 deletions

View File

@ -15,6 +15,7 @@ local math = { modf = math.modf }
local string = { format = string.format, local string = { format = string.format,
match = string.match, match = string.match,
rep = string.rep } rep = string.rep }
local type = type
local tonumber = tonumber local tonumber = tonumber
local setmetatable = setmetatable local setmetatable = setmetatable
@ -68,7 +69,7 @@ local function worker(args)
alsabar.tooltip = awful.tooltip({ objects = { alsabar.bar } }) alsabar.tooltip = awful.tooltip({ objects = { alsabar.bar } })
function alsabar.update() function alsabar.update(callback)
helpers.async(alsabar.cmd, function(mixer) helpers.async(alsabar.cmd, function(mixer)
local volu,mute = string.match(mixer, "([%d]+)%%.*%[([%l]*)") local volu,mute = string.match(mixer, "([%d]+)%%.*%[([%l]*)")
if (volu and tonumber(volu) ~= alsabar._current_level) or (mute and string.match(mute, "on") ~= alsabar._muted) then if (volu and tonumber(volu) ~= alsabar._current_level) or (mute and string.match(mute, "on") ~= alsabar._muted) then
@ -89,6 +90,8 @@ local function worker(args)
volume_now.status = mute volume_now.status = mute
settings() settings()
if type(callback) == "function" then callback() end
end end
end) end)
end end