From f05ebc5d982d1ea31cb2ece1a9bbc720cc3622ce Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Tue, 17 Feb 2015 18:38:24 +0100 Subject: [PATCH 1/2] awful.tag: fix call to update_urgent from client_untagged Ref: #130 --- lib/awful/tag.lua.in | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/awful/tag.lua.in b/lib/awful/tag.lua.in index b1ddca30c..aa552fcba 100644 --- a/lib/awful/tag.lua.in +++ b/lib/awful/tag.lua.in @@ -633,9 +633,8 @@ capi.client.connect_signal("manage", function(c) end) -- Keep track of the number of urgent clients. -local function update_urgent(c,t) - local modif = c.urgent == true and 1 or -1 - local count = tag.getproperty(t,"urgent_count") or 0 +local function update_urgent(c, t, modif) + local count = tag.getproperty(t, "urgent_count") or 0 count = (count + modif) >= 0 and (count + modif) or 0 tag.setproperty(t,"urgent" , count > 0) tag.setproperty(t,"urgent_count", count ) @@ -644,21 +643,21 @@ end -- Update the urgent counter when a client is tagged. local function client_tagged(c,t) if c.urgent then - update_urgent(c,t) + update_urgent(c, t, 1) end end -- Update the urgent counter when a client is untagged. local function client_untagged(c,t) if c.urgent then - update_urgent(c,t) + update_urgent(c, t, -1) end end -- Count the urgent clients. local function urgent_callback(c) for k,t in ipairs(c:tags()) do - update_urgent(c,t) + update_urgent(c, t, c.urgent and 1 or -1) end end From 8b6acb830f5f46acea8bc2297e38cffb42341017 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Tue, 17 Feb 2015 18:55:26 +0100 Subject: [PATCH 2/2] minor: code style fixes --- lib/awful/tag.lua.in | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/awful/tag.lua.in b/lib/awful/tag.lua.in index aa552fcba..dcd230324 100644 --- a/lib/awful/tag.lua.in +++ b/lib/awful/tag.lua.in @@ -69,13 +69,13 @@ end --- Swap 2 tags -- @param tag1 The first tag -- @param tag2 The second tag -function tag.swap(tag1,tag2) - local idx1, idx2 = tag.getidx(tag1),tag.getidx(tag2) - local src2, src1 = tag.getscreen(tag2),tag.getscreen(tag1) - tag.setscreen(tag2,src1) - tag.move(idx1,tag2) - tag.setscreen(tag1,scr2) - tag.move(idx2,tag1) +function tag.swap(tag1, tag2) + local idx1, idx2 = tag.getidx(tag1), tag.getidx(tag2) + local src2, src1 = tag.getscreen(tag2), tag.getscreen(tag1) + tag.setscreen(tag2, src1) + tag.move(idx1, tag2) + tag.setscreen(tag1, scr2) + tag.move(idx2, tag1) end --- Add a tag. @@ -191,7 +191,7 @@ function tag.delete(target_tag, fallback_tag) target_tag.activated = false -- Update all indexes - for i=idx+1,#tags do + for i=idx+1, #tags do tag.setproperty(tags[i], "index", i-1) end @@ -318,7 +318,7 @@ function tag.setscreen(t, s) end -- Update all indexes - for _,screen in ipairs {old_screen,s} do + for _,screen in ipairs {old_screen, s} do for i,t in ipairs(tag.gettags(screen)) do tag.setproperty(t, "index", i) end @@ -326,7 +326,7 @@ function tag.setscreen(t, s) -- Restore the old screen history if the tag was selected if sel then - tag.history.restore(old_screen,1) + tag.history.restore(old_screen, 1) end end @@ -636,19 +636,19 @@ end) local function update_urgent(c, t, modif) local count = tag.getproperty(t, "urgent_count") or 0 count = (count + modif) >= 0 and (count + modif) or 0 - tag.setproperty(t,"urgent" , count > 0) - tag.setproperty(t,"urgent_count", count ) + tag.setproperty(t, "urgent" , count > 0) + tag.setproperty(t, "urgent_count", count ) end -- 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 update_urgent(c, t, 1) end end -- 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 update_urgent(c, t, -1) end