From 3e22142501b60b3d1d2ed9c40bb29fd40aa44f4d Mon Sep 17 00:00:00 2001 From: elenapan Date: Sat, 21 Mar 2020 07:23:57 +0200 Subject: [PATCH] Add signal for raising urgent clients when switching tags --- config/awesome/helpers.lua | 14 -------------- config/awesome/rc.lua | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/config/awesome/helpers.lua b/config/awesome/helpers.lua index 2fb75af..7928cb3 100644 --- a/config/awesome/helpers.lua +++ b/config/awesome/helpers.lua @@ -160,10 +160,6 @@ end -- Useful for quick switching after for example checking an incoming chat -- message at tag 2 and coming back to your work at tag 1 with the same -- keypress. --- Also focuses urgent clients if they exist in the tag. This fixes the issue --- (visual mismatch) where after switching to a tag which includes an urgent --- client, the urgent client is unfocused but still covers all other windows --- (even the currently focused window). function helpers.tag_back_and_forth(tag_index) local s = mouse.screen local tag = s.tags[tag_index] @@ -173,19 +169,9 @@ function helpers.tag_back_and_forth(tag_index) else tag:view_only() end - - local urgent_clients = function (c) - return awful.rules.match(c, {urgent = true, first_tag = tag}) - end - - for c in awful.client.iterate(urgent_clients) do - client.focus = c - c:raise() - end end end - -- Resize DWIM (Do What I Mean) -- Resize client or factor -- Constants -- diff --git a/config/awesome/rc.lua b/config/awesome/rc.lua index b3fa680..840a303 100644 --- a/config/awesome/rc.lua +++ b/config/awesome/rc.lua @@ -959,6 +959,21 @@ client.connect_signal("request::activate", function(c, context, hints) end end) +-- When switching to a tag with urgent clients, raise them. +-- This fixes the issue (visual mismatch) where after switching to +-- a tag which includes an urgent client, the urgent client is +-- unfocused but still covers all other windows (even the currently +-- focused window). +awful.tag.attached_connect_signal(s, "property::selected", function () + local urgent_clients = function (c) + return awful.rules.match(c, {urgent = true, first_tag = mouse.screen.selected_tag}) + end + for c in awful.client.iterate(urgent_clients) do + client.focus = c + c:raise() + end +end) + -- Focus urgent clients automatically -- client.connect_signal("property::urgent", function(c) -- if c.urgent then