From e522245f1e2e77fb15b82fe1a0c1a6505be65aea Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 25 Feb 2021 17:33:32 +0100 Subject: pager: mark urgent clients on all pagers --- pager.lua | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/pager.lua b/pager.lua index d1c6b9f..1a0fb84 100644 --- a/pager.lua +++ b/pager.lua @@ -29,10 +29,10 @@ function Page:client_remove(client) self._widgets[client] = nil end -function Page:client_add(client) +function Page:client_add(c) local font = beautiful.small_text_font or "sans 7" - local text = client.name + local text = c.name local bg_normal = beautiful.bg_normal or "#000000" local fg_normal = beautiful.fg_normal or "#ffffff" @@ -46,31 +46,39 @@ function Page:client_add(client) tb:set_font(font) - client:connect_signal("property::name", function() tb:set_text(client.name or "") end) - client:connect_signal("focus", + c:connect_signal("property::name", function() tb:set_text(c.name or "") end) + c:connect_signal("focus", function(c) if c.screen == self.screen then bg:set_bg(bg_focus) bg:set_fg(fg_focus) end end) - client:connect_signal("unfocus", + c:connect_signal("unfocus", function(c) if c.screen == self.screen then bg:set_bg(bg_normal) bg:set_fg(fg_normal) end end) - client:connect_signal("property::urgent", + c:connect_signal("property::urgent", function(c) - if c.screen == self.screen then + if c.urgent then bg:set_bg(bg_urgent) bg:set_fg(fg_urgent) + else + if c == client.focus and c.screen == self.screen then + bg:set_bg(bg_focus) + bg:set_fg(fg_focus) + else + bg:set_bg(bg_normal) + bg:set_fg(fg_normal) + end end end) self.client_container:add(bg) - self._widgets[client] = bg + self._widgets[c] = bg end function Page:new(tag, width, height, screen) -- cgit v1.2.3