Free ram for widgets with clients previews (#117)

This commit is contained in:
Kasper 2021-10-03 13:19:48 +03:00 committed by GitHub
parent 7f17e7bb8b
commit 394c3ceeb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 18 deletions

View File

@ -107,7 +107,7 @@ local function draw_widget(
end
end
return {
return wibox.widget {
{
{
{
@ -182,23 +182,21 @@ local enable = function(opts)
tag_preview_box.maximum_width = scale * geo.width + margin * 2
tag_preview_box.maximum_height = scale * geo.height + margin * 2
tag_preview_box:setup(
draw_widget(
t,
tag_preview_image,
scale,
screen_radius,
client_radius,
client_opacity,
client_bg,
client_border_color,
client_border_width,
widget_bg,
widget_border_color,
widget_border_width,
geo,
margin
)
tag_preview_box.widget = draw_widget(
t,
tag_preview_image,
scale,
screen_radius,
client_radius,
client_opacity,
client_bg,
client_border_color,
client_border_width,
widget_bg,
widget_border_color,
widget_border_width,
geo,
margin
)
end)
@ -208,6 +206,11 @@ local enable = function(opts)
tag_preview_box.y = s.geometry.y + widget_y
end
if v == false then
tag_preview_box.widget = nil
collectgarbage("collect")
end
tag_preview_box.visible = v
end)
end

View File

@ -153,6 +153,9 @@ local enable = function(opts)
widget_width,
widget_height
)
else
task_preview_box.widget = nil
collectgarbage("collect")
end
if not placement_fn then

View File

@ -59,6 +59,8 @@ local window_switcher_hide = function(window_switcher_box)
-- Stop and hide window_switcher
awful.keygrabber.stop(window_switcher_grabber)
window_switcher_box.visible = false
window_switcher_box.widget = nil
collectgarbage("collect")
end
local function draw_widget(