From 6e77e55d04a1ea7d809063767d1c6ed241e292a1 Mon Sep 17 00:00:00 2001 From: Ksaper Date: Sun, 19 Feb 2023 17:36:14 +0200 Subject: [PATCH] No need to recreate the timer --- widget/app_launcher/init.lua | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/widget/app_launcher/init.lua b/widget/app_launcher/init.lua index d6aaed6..914c6c1 100644 --- a/widget/app_launcher/init.lua +++ b/widget/app_launcher/init.lua @@ -758,7 +758,15 @@ local function new(args) gtable.crush(ret, app_launcher, true) gtable.crush(ret, args, true) - -- These widgets need to be later accessed + ret._private.search_timer = gtimer { + timeout = 0.05, + autostart = true, + single_shot = true, + callback = function() + search(ret, ret._private.text) + end + } + ret._private.prompt = prompt { prompt = ret.prompt_label, @@ -771,20 +779,8 @@ local function new(args) return end - if ret._private.search_timer ~= nil and ret._private.search_timer.started then - ret._private.search_timer:stop() - end - - ret._private.search_timer = gtimer { - timeout = 0.05, - autostart = true, - single_shot = true, - callback = function() - search(ret, text) - end - } - ret._private.text = text + ret._private.search_timer:again() end, keypressed_callback = function(mod, key, cmd) if key == "Escape" then