From b0dd27ec7e59916a2e54cf1713e24334a2ee54ee Mon Sep 17 00:00:00 2001 From: aarondill Date: Sun, 30 Jun 2024 00:47:10 -0500 Subject: [PATCH] fix: call ret:emit_signal("timeout") instead of args.callback This ensures that the timer gets passed on the first call of callback. fixes: #3904 Signed-off-by: aarondill --- lib/gears/timer.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/gears/timer.lua b/lib/gears/timer.lua index b8ab26fb86..5606b87a42 100644 --- a/lib/gears/timer.lua +++ b/lib/gears/timer.lua @@ -205,12 +205,11 @@ function timer.new(args) end if args.callback then - if args.call_now then - args.callback() - end ret:connect_signal("timeout", args.callback) end - + if args.call_now then + ret:emit_signal("timeout") + end if args.single_shot then ret:connect_signal("timeout", function() ret:stop() end) end