Fixed a couple of error-creating bugs for battery and client-volume
This commit is contained in:
parent
9842227176
commit
b80ec3fdb4
|
@ -31,7 +31,7 @@ return function(args)
|
||||||
local icon_name = out:match("icon%-name:%s+'(battery%-[^']+)'")
|
local icon_name = out:match("icon%-name:%s+'(battery%-[^']+)'")
|
||||||
local value = out:match("percentage:%s+(%d+%%)")
|
local value = out:match("percentage:%s+(%d+%%)")
|
||||||
icon:get_children_by_id("widget_icon")[1].image =
|
icon:get_children_by_id("widget_icon")[1].image =
|
||||||
style[icon_name:gsub("%-","_")] or
|
style[(icon_name or ""):gsub("%-","_")] or
|
||||||
style["battery_missing_symbolic"]
|
style["battery_missing_symbolic"]
|
||||||
if args.percentage and value then
|
if args.percentage and value then
|
||||||
icon:get_children_by_id("widget_text")[1].markup = value
|
icon:get_children_by_id("widget_text")[1].markup = value
|
||||||
|
|
|
@ -22,7 +22,7 @@ local get_app_volume = function(pid)
|
||||||
for key,process in pairs(get_pactl_data()) do
|
for key,process in pairs(get_pactl_data()) do
|
||||||
-- Match app by pid
|
-- Match app by pid
|
||||||
if process:match("application.process.id = \""..tostring(pid).."\"") then
|
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
|
||||||
end
|
end
|
||||||
-- Return nil and an error if not found matching process
|
-- Return nil and an error if not found matching process
|
||||||
|
@ -93,7 +93,7 @@ return function(args)
|
||||||
if value then
|
if value then
|
||||||
slider.value = value
|
slider.value = value
|
||||||
widget.children[2] = slider
|
widget.children[2] = slider
|
||||||
widget.children[1].image = get_icon(tonumber(value))
|
widget.children[1].image = get_icon(value)
|
||||||
else
|
else
|
||||||
warning_text.markup = err
|
warning_text.markup = err
|
||||||
widget.children[2] = warning_text
|
widget.children[2] = warning_text
|
||||||
|
@ -102,7 +102,7 @@ return function(args)
|
||||||
end)
|
end)
|
||||||
slider:connect_signal("widget::redraw_needed",function()
|
slider:connect_signal("widget::redraw_needed",function()
|
||||||
set_app_volume(client.focus.pid,slider.value)
|
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)
|
end)
|
||||||
else
|
else
|
||||||
warning_text.markup = "pactl is not available"
|
warning_text.markup = "pactl is not available"
|
||||||
|
|
Loading…
Reference in New Issue