From 5140792411efc4d78410d02a68692f684690c03b Mon Sep 17 00:00:00 2001 From: crater2150 Date: Mon, 20 Nov 2017 10:21:35 +0100 Subject: [PATCH] Allow disabling sloppy focus for certain clients (e.g. password prompts) --- signals.lua | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/signals.lua b/signals.lua index f5d1dcd..293f8d8 100644 --- a/signals.lua +++ b/signals.lua @@ -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