mirror of
https://github.com/awesomeWM/awesome
synced 2024-11-17 07:47:41 +01:00
taglist: call taglist_update only once per main loop
Currently `taglist_update` gets triggered often, because it listens to a lot of signals. This patch makes it only call the last one through `timer.delayed_call`.
This commit is contained in:
parent
1924e044f7
commit
5630ad1bb2
1 changed files with 12 additions and 2 deletions
|
@ -22,6 +22,7 @@ local tag = require("awful.tag")
|
|||
local beautiful = require("beautiful")
|
||||
local fixed = require("wibox.layout.fixed")
|
||||
local surface = require("gears.surface")
|
||||
local timer = require("gears.timer")
|
||||
|
||||
local taglist = { mt = {} }
|
||||
taglist.filter = {}
|
||||
|
@ -158,9 +159,18 @@ function taglist.new(screen, filter, buttons, style, update_function, base_widge
|
|||
local w = base_widget or fixed.horizontal()
|
||||
|
||||
local data = setmetatable({}, { __mode = 'k' })
|
||||
|
||||
local queued_update = {}
|
||||
local u = function (s)
|
||||
if s == screen then
|
||||
taglist_update(s, w, buttons, filter, data, style, uf)
|
||||
if s ~= screen then return end
|
||||
|
||||
-- Add a delayed callback for the first update.
|
||||
if not queued_update[s] then
|
||||
timer.delayed_call(function()
|
||||
taglist_update(s, w, buttons, filter, data, style, uf)
|
||||
queued_update[s] = false
|
||||
end)
|
||||
queued_update[s] = true
|
||||
end
|
||||
end
|
||||
local uc = function (c) return u(c.screen) end
|
||||
|
|
Loading…
Reference in a new issue