Workaround for volume not being available during startup

This commit is contained in:
Thomas Avé 2023-03-23 09:46:30 +01:00
parent daf0f5ab35
commit 9f1d406ac0
1 changed files with 4 additions and 2 deletions

View File

@ -181,9 +181,11 @@ local function worker(user_args)
elseif mute == 'on' then widget:unmute() elseif mute == 'on' then widget:unmute()
end end
local volume_level = string.match(stdout, "(%d?%d?%d)%%") -- (\d?\d?\d)\%) local volume_level = string.match(stdout, "(%d?%d?%d)%%") -- (\d?\d?\d)\%)
if volume_level ~= nil then
volume_level = string.format("% 3d", volume_level) volume_level = string.format("% 3d", volume_level)
widget:set_volume_level(volume_level) widget:set_volume_level(volume_level)
end end
end
function volume:inc(s) function volume:inc(s)
spawn.easy_async(INC_VOLUME_CMD(device, s or step), function(stdout) update_graphic(volume.widget, stdout) end) spawn.easy_async(INC_VOLUME_CMD(device, s or step), function(stdout) update_graphic(volume.widget, stdout) end)