From 7c3fb9edb776d47c91aca42389a746336d151a2e Mon Sep 17 00:00:00 2001 From: Perry Hargrave Date: Thu, 12 May 2011 10:30:21 -0700 Subject: [PATCH] awful.client.jumpto: View urgent clients smarter Only do a tag.viewonly() if the urgent client is not visible. Further, if the boolean 'merge' parameter is true [default false], then to a tag.viewmore() with all the currently visible tags. Signed-off-by: Uli Schlachter --- lib/awful/client.lua.in | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/awful/client.lua.in b/lib/awful/client.lua.in index 0ab5f139..1f18963f 100644 --- a/lib/awful/client.lua.in +++ b/lib/awful/client.lua.in @@ -56,7 +56,8 @@ function urgent.get() end --- Jump to the client that received the urgent hint first. -function urgent.jumpto() +-- @param merge If true then merge tags when clients are not visible. +function urgent.jumpto(merge) local c = urgent.get() if c then local s = capi.client.focus and capi.client.focus.screen or capi.mouse.screen @@ -64,10 +65,17 @@ function urgent.jumpto() if s ~= c.screen then capi.mouse.screen = c.screen end - -- focus the tag only if the client is not sticky - if not c.sticky then - tag.viewonly(c:tags()[1]) + + -- Try to make client visible, this also covers e.g. sticky + local t = c:tags()[1] + if t and not c:isvisible() then + if merge then + t.selected = true + else + tag.viewonly(t) + end end + -- focus the client capi.client.focus = c c:raise() -- 2.11.4.GIT