From b02ebf7d67a9925bbd522265eda61030f2d8b4e9 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Tue, 3 Sep 2019 10:15:13 +0200 Subject: Switch the "focus client under mouse after switching tags" function to a delayed_call timer --- config/awesome/rc.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/config/awesome/rc.lua b/config/awesome/rc.lua index a34984e..a88c49e 100644 --- a/config/awesome/rc.lua +++ b/config/awesome/rc.lua @@ -3,6 +3,7 @@ local gears = require("gears") local awful = require("awful") awful.rules = require("awful.rules") require("awful.autofocus") +local gears = require("gears") -- Widget and layout library local wibox = require("wibox") -- Theme handling library @@ -694,6 +695,9 @@ 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) +-- focus the client under the mouse after changing to a new tag, unless we're bringing +-- a focused client with us in viewidx_no_wrap() +-- -- from/inspired by https://stackoverflow.com/a/30684548 do_not_reset_focus = false tag.connect_signal( @@ -702,16 +706,12 @@ tag.connect_signal( local selected = tostring(t.selected) == "false" if selected then if not do_not_reset_focus then - local focus_timer = timer({ timeout = 0.05 }) - focus_timer:connect_signal("timeout", function() + gears.timer.delayed_call( 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 do_not_reset_focus = false end -- cgit v1.2.3