From c6aee2afa3c633c5724749a71ebfc6cbaba949a5 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 29 May 2021 12:12:23 +0200 Subject: rc: move sloppy focus handling out of the manage callback Connect the focus-setting signal statically for all clients, the way it is done in the default rc. Might be more efficient, also does not clutter the manage callback. --- rc.lua | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/rc.lua b/rc.lua index 8e72d05..1802d73 100644 --- a/rc.lua +++ b/rc.lua @@ -148,14 +148,6 @@ awful.rules.rules = { -- {{{ Signals -- Signal function to execute when a new client appears. client.connect_signal("manage", function (c, startup) - -- Enable sloppy focus - c:connect_signal("mouse::enter", function(c) - if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier - and awful.client.focus.filter(c) then - client.focus = c - end - end) - if not startup then -- Set the windows at the slave, -- i.e. put it at the end of others instead of setting it master. @@ -184,4 +176,14 @@ end) client.connect_signal("focus", function(c) c.border_color = "#b0e2ff" end) client.connect_signal("unfocus", function(c) c.border_color = "#000000" end) + +-- Enable sloppy focus +client.connect_signal("mouse::enter", + function(c) + if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier + and awful.client.focus.filter(c) then + client.focus = c + end + end) + -- }}} -- cgit v1.2.3