diff --git a/widgets/battery.lua b/widgets/battery.lua index 43fc4b7..37a70d1 100644 --- a/widgets/battery.lua +++ b/widgets/battery.lua @@ -31,7 +31,7 @@ return function(args) local icon_name = out:match("icon%-name:%s+'(battery%-[^']+)'") local value = out:match("percentage:%s+(%d+%%)") icon:get_children_by_id("widget_icon")[1].image = - style[icon_name:gsub("%-","_")] or + style[(icon_name or ""):gsub("%-","_")] or style["battery_missing_symbolic"] if args.percentage and value then icon:get_children_by_id("widget_text")[1].markup = value diff --git a/widgets/client-volume.lua b/widgets/client-volume.lua index f924b80..a0e9021 100644 --- a/widgets/client-volume.lua +++ b/widgets/client-volume.lua @@ -22,7 +22,7 @@ local get_app_volume = function(pid) for key,process in pairs(get_pactl_data()) do -- Match app by pid if process:match("application.process.id = \""..tostring(pid).."\"") then - return process:match("Volume: .-(%d?%d?%d)%%") + return tonumber(process:match("Volume: .-(%d?%d?%d)%%")) end end -- Return nil and an error if not found matching process @@ -93,7 +93,7 @@ return function(args) if value then slider.value = value widget.children[2] = slider - widget.children[1].image = get_icon(tonumber(value)) + widget.children[1].image = get_icon(value) else warning_text.markup = err widget.children[2] = warning_text @@ -102,7 +102,7 @@ return function(args) end) slider:connect_signal("widget::redraw_needed",function() set_app_volume(client.focus.pid,slider.value) - widget.children[1].image = get_icon(tonumber(slider.value)) + widget.children[1].image = get_icon(slider.value) end) else warning_text.markup = "pactl is not available"