Browse Source

Fixed a couple of error-creating bugs for battery and client-volume

master
Yessiest 2 years ago
parent
commit
b80ec3fdb4
  1. 2
      widgets/battery.lua
  2. 6
      widgets/client-volume.lua

2
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

6
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"

Loading…
Cancel
Save