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
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_width = scale * geo.width + margin * 2
tag_preview_box.maximum_height = scale * geo.height + margin * 2 tag_preview_box.maximum_height = scale * geo.height + margin * 2
tag_preview_box:setup( tag_preview_box.widget = draw_widget(
draw_widget( t,
t, tag_preview_image,
tag_preview_image, scale,
scale, screen_radius,
screen_radius, client_radius,
client_radius, client_opacity,
client_opacity, client_bg,
client_bg, client_border_color,
client_border_color, client_border_width,
client_border_width, widget_bg,
widget_bg, widget_border_color,
widget_border_color, widget_border_width,
widget_border_width, geo,
geo, margin
margin
)
) )
end) end)
@ -208,6 +206,11 @@ local enable = function(opts)
tag_preview_box.y = s.geometry.y + widget_y tag_preview_box.y = s.geometry.y + widget_y
end end
if v == false then
tag_preview_box.widget = nil
collectgarbage("collect")
end
tag_preview_box.visible = v tag_preview_box.visible = v
end) end)
end end

View File

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

View File

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