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 30b0f1c654
commit 7c3fb9edb7
1 changed files with 12 additions and 4 deletions

View File

@ -56,7 +56,8 @@ function urgent.get()
end end
--- Jump to the client that received the urgent hint first. --- 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() local c = urgent.get()
if c then if c then
local s = capi.client.focus and capi.client.focus.screen or capi.mouse.screen 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 if s ~= c.screen then
capi.mouse.screen = c.screen capi.mouse.screen = c.screen
end end
-- focus the tag only if the client is not sticky
if not c.sticky then -- Try to make client visible, this also covers e.g. sticky
tag.viewonly(c:tags()[1]) local t = c:tags()[1]
if t and not c:isvisible() then
if merge then
t.selected = true
else
tag.viewonly(t)
end
end end
-- focus the client -- focus the client
capi.client.focus = c capi.client.focus = c
c:raise() c:raise()