Skip to content

Instantly share code, notes, and snippets.

@blueyed
Created March 29, 2014 09:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blueyed/9851452 to your computer and use it in GitHub Desktop.
Save blueyed/9851452 to your computer and use it in GitHub Desktop.
local ewmh = require("awful.ewmh")
client.disconnect_signal("request::activate", awful.ewmh.activate)
client.connect_signal("request::activate", function(c)
if not c:isvisible() then
-- Meant to handle opening a link from somewhere.
-- Causes Firefox to steal the focus on other events though!
-- Would need some magic flag being set via open-in-running-browser.
-- if c.class == "Firefox" and c.type == "normal" then
-- awful.client.jumpto(c)
-- -- awful.tag.viewonly(c:tags()[1])
-- end
end
r = false
if c:isvisible() then
if c.class == 'Firefox' then
-- Prevent Firefox from stealing focus (if a page reloads etc)
-- r = awful.client.floating.get(c)
r = c.type ~= "normal"
else
r = true
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),
RETURN=r
}, "request::activate")
if r then
client.focus = c
c:raise()
else
if not awesome.startup then
c.urgent = true
end
end
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment