Allow disabling sloppy focus for certain clients (e.g. password prompts)

This commit is contained in:
crater2150 2017-11-20 10:21:35 +01:00
parent d9a1a3be0c
commit 5140792411

View file

@ -3,19 +3,6 @@ local beautiful = beautiful
client.connect_signal("manage", function (c)
--c:connect_signal("mouse::enter", function(c)
-- if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
-- and awful.client.focus.filter(c)
-- and not(
-- client.focus ~= nil
-- and client.focus.class == "jetbrains-idea"
-- and c.class == "jetbrains-idea"
-- and client.focus.type == "dialog"
-- ) then
-- client.focus = c
-- end
--end)
-- Set the windows at the slave,
-- i.e. put it at the end of others instead of setting it master.
-- if not awesome.startup then awful.client.setslave(c) end
@ -28,9 +15,22 @@ client.connect_signal("manage", function (c)
end
end)
local fixed_clients = {
-- action search and similar windows in IDEA
{ rule = { name = "", class = "jetbrains-idea", type = "dialog" } },
-- password inputs
{ rule = { class = "Pinentry-gtk-2" } },
}
local function may_lose_focus(c)
if c ~= nil then return true end
return not awful.rules.matches_list(c, fixed_clients)
end
-- Enable sloppy focus, so that focus follows mouse.
client.connect_signal("mouse::enter", function(c)
if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
if may_lose_focus(client.focus)
and awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
and awful.client.focus.filter(c) then
client.focus = c
end