Created
February 11, 2015 23:33
-
-
Save blueyed/021f1415eb496e8b3721 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
client.disconnect_signal("request::activate", awful.ewmh.activate) | |
client.connect_signal("request::activate", function(c, context) | |
-- context: 'rules' or 'ewmh' | |
-- bnote(bdump({'request::activate', c_isvisible=c:isvisible(), context=context})) | |
bdebug({'request::activate', c_isvisible=c:isvisible(), context=context}, 'request_activate') | |
if awesome.startup then | |
client.focus = c | |
c:raise() | |
return | |
end | |
raise = false | |
if c:isvisible() then | |
if c.class == 'Firefox' then | |
-- Prevent Firefox from stealing focus (if a page reloads etc) | |
if force_raise_client(c) then | |
raise = true | |
elseif context == 'rules' then | |
raise = true | |
else | |
-- _NET_ACTIVE_WINDOW ewmh request (rofi) | |
-- But also after a page finishes loading / Firefox reloads a page! | |
raise = false | |
end | |
else | |
raise = true | |
end | |
else | |
-- Meant to handle opening a link from somewhere. | |
-- Causes Firefox to steal the focus on other events though! | |
-- bnote(c.class .. c.type) | |
-- bnote(tostring(tostring(c.pid) == io.open("/tmp/awesome-raise-next-client"):read())) | |
if c.class == "Firefox" and c.type == "normal" and force_raise_client(c) then | |
awful.client.jumpto(c) | |
raise = true | |
-- awful.tag.viewonly(c:tags()[1]) | |
else | |
raise = false | |
end | |
end | |
-- bdebug({c=c, c_name=c.name and c.name or "no name", isvisible=c:isvisible(), transient_for=c.transient_for, | |
-- floating=awful.client.floating.get(c), context=context, tb=tb, RETURN=raise | |
-- }, "request::activate") | |
if raise then | |
-- TODO: triggers layout change. | |
client.focus = c | |
c:raise() | |
bnote('request::activate: adding to history.') | |
cyclefocus.history.add(c) | |
else | |
c.urgent = true | |
end | |
end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment