Merge pull request #137 from blueyed/fix-urgent-tags

awful.tag: fix call to update_urgent from client_untagged
This commit is contained in:
Emmanuel Lepage Vallée 2015-02-18 21:04:42 +00:00
commit e36b2549e7
1 changed files with 19 additions and 20 deletions

View File

@ -633,8 +633,7 @@ capi.client.connect_signal("manage", function(c)
end) end)
-- Keep track of the number of urgent clients. -- Keep track of the number of urgent clients.
local function update_urgent(c,t) local function update_urgent(c, t, modif)
local modif = c.urgent == true and 1 or -1
local count = tag.getproperty(t, "urgent_count") or 0 local count = tag.getproperty(t, "urgent_count") or 0
count = (count + modif) >= 0 and (count + modif) or 0 count = (count + modif) >= 0 and (count + modif) or 0
tag.setproperty(t, "urgent" , count > 0) tag.setproperty(t, "urgent" , count > 0)
@ -644,21 +643,21 @@ end
-- Update the urgent counter when a client is tagged. -- Update the urgent counter when a client is tagged.
local function client_tagged(c, t) local function client_tagged(c, t)
if c.urgent then if c.urgent then
update_urgent(c,t) update_urgent(c, t, 1)
end end
end end
-- Update the urgent counter when a client is untagged. -- Update the urgent counter when a client is untagged.
local function client_untagged(c, t) local function client_untagged(c, t)
if c.urgent then if c.urgent then
update_urgent(c,t) update_urgent(c, t, -1)
end end
end end
-- Count the urgent clients. -- Count the urgent clients.
local function urgent_callback(c) local function urgent_callback(c)
for k,t in ipairs(c:tags()) do for k,t in ipairs(c:tags()) do
update_urgent(c,t) update_urgent(c, t, c.urgent and 1 or -1)
end end
end end