diff options
author | Anton Khirnov <anton@khirnov.net> | 2021-02-25 17:33:32 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2021-02-25 17:33:32 +0100 |
commit | e522245f1e2e77fb15b82fe1a0c1a6505be65aea (patch) | |
tree | 9455bb51a92b597bc51b9f94cd323fabbba74b46 | |
parent | a974614ee77426872fc34b2f60a851c3eda2a535 (diff) |
pager: mark urgent clients on all pagers
-rw-r--r-- | pager.lua | 24 |
1 files changed, 16 insertions, 8 deletions
@@ -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) |