I simply split `awful.client.urgent.jumpto` to get this; needed it in my rc.lua.
-- Anurag Priyam
From 67a6ebb39623a083d60ab515bd52eeb8cd66bdce Mon Sep 17 00:00:00 2001 From: Anurag Priyam <[email protected]> Date: Wed, 7 Mar 2012 03:39:45 +0530 Subject: [PATCH] introducing awful.client.jumpto I simply moved out the code to 'jumpto' a client from `awful.client.urgent.jumpto` into a separate function of its own so that it can be reused. Signed-off-by: Anurag Priyam <[email protected]> --- lib/awful/client.lua.in | 46 +++++++++++++++++++++++++++------------------- 1 files changed, 27 insertions(+), 19 deletions(-) diff --git a/lib/awful/client.lua.in b/lib/awful/client.lua.in index 6549488..03dcfab 100644 --- a/lib/awful/client.lua.in +++ b/lib/awful/client.lua.in @@ -39,6 +39,32 @@ floating = {} dockable = {} property = {} +--- +-- Jump to the given client. Takes care of focussing the screen, the right tag, +-- etc. +-- @param merge If true then merge tags when clients are not visible. +function jumpto(c, merge) + local s = capi.client.focus and capi.client.focus.screen or capi.mouse.screen + -- focus the screen + if s ~= c.screen then + capi.mouse.screen = c.screen + end + + -- 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() +end + --- Get the first client that got the urgent hint. -- @return The first urgent client. function urgent.get() @@ -60,25 +86,7 @@ end 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 - -- focus the screen - if s ~= c.screen then - capi.mouse.screen = c.screen - end - - -- 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() + jumpto(c, merge) end end -- 1.7.9
