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 <psychon@znc.in>
This commit is contained in:
Perry Hargrave 2011-05-12 10:30:21 -07:00 committed by Uli Schlachter
parent be7fda45d8
commit c606bc36a8
1 changed files with 12 additions and 4 deletions

View File

@ -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()