fix to prevent stdout from passing a null string
This commit is contained in:
parent
adb6d2accc
commit
0a7bdb8528
|
@ -74,15 +74,18 @@ local function worker(user_args)
|
||||||
widget = wibox.container.arcchart
|
widget = wibox.container.arcchart
|
||||||
}
|
}
|
||||||
|
|
||||||
local update_graphic = function(_, stdout, _, _, _)
|
local update_graphic = function(widget, stdout, _, _, _)
|
||||||
local mute = string.match(stdout, "%[(o%D%D?)%]") -- \[(o\D\D?)\] - [on] or [off]
|
local mute = "on"
|
||||||
local volume = string.match(stdout, "(%d?%d?%d)%%") -- (\d?\d?\d)\%)
|
local volume = 0
|
||||||
volume = tonumber(string.format("% 3d", volume))
|
if not (stdout == nil or stdout == '') then
|
||||||
|
mute = string.match(stdout, "%[(o%D%D?)%]") -- \[(o\D\D?)\] - [on] or [off]
|
||||||
|
volume = string.match(tostring(stdout), "(%d?%d?%d)%%") -- (\d?\d?\d)\%)
|
||||||
|
volume = tonumber(string.format("% 3d", volume))
|
||||||
|
end
|
||||||
widget.value = volume / 100;
|
widget.value = volume / 100;
|
||||||
widget.colors = mute == 'off'
|
widget.colors = mute == 'off'
|
||||||
and { mute_color }
|
and { mute_color }
|
||||||
or { main_color }
|
or { main_color }
|
||||||
end
|
end
|
||||||
|
|
||||||
local button_press = args.button_press or function(_, _, _, button)
|
local button_press = args.button_press or function(_, _, _, button)
|
||||||
|
|
Loading…
Reference in New Issue