From 99a81d2117b50ce461324ad622a6658f164c4f4d Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Mon, 19 Dec 2016 07:53:51 +0100 Subject: change focus to item under mouse after tag change --- config/awesome/rc.lua | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/config/awesome/rc.lua b/config/awesome/rc.lua index dc0a50d..9daf950 100644 --- a/config/awesome/rc.lua +++ b/config/awesome/rc.lua @@ -581,6 +581,26 @@ end) client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end) client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) + +-- from/inspired by https://stackoverflow.com/a/30684548 +tag.connect_signal( + "property::selected", + function (t) + local selected = tostring(t.selected) == "false" + if selected then + local focus_timer = timer({ timeout = 0.05 }) + focus_timer:connect_signal("timeout", function() + local c = awful.mouse.client_under_pointer() + if not (c == nil) then + client.focus = c + -- c:raise() + end + focus_timer:stop() + end) + focus_timer:start() + end + end +) -- }}} terminal = "urxvt" -- cgit v1.2.3