From 93327aeccf9d32c5b3c5b1b11063715cad9b324f Mon Sep 17 00:00:00 2001 From: Ksaper Date: Mon, 27 Feb 2023 11:21:47 +0200 Subject: [PATCH] Add a method to get the text + add a search signal --- widget/app_launcher/init.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/widget/app_launcher/init.lua b/widget/app_launcher/init.lua index ab25d4c..208fcf2 100644 --- a/widget/app_launcher/init.lua +++ b/widget/app_launcher/init.lua @@ -396,7 +396,7 @@ local function build_widget(self) end) self:get_prompt():connect_signal("text::changed", function(_, text) - if text == self._private.text then + if text == self:get_text() then return end @@ -474,7 +474,7 @@ function app_launcher:refresh() end function app_launcher:search() - local text = self._private.text + local text = self:get_text() local old_pos = self:get_grid():get_widget_position(self._private.active_widget) -- Reset all the matched apps @@ -533,6 +533,8 @@ function app_launcher:search() local app = self:get_grid():get_widgets_at(1, 1)[1] app:select() end + + self:emit_signal("search", self:get_text(), self:get_current_page(), self:get_pages_count()) end function app_launcher:scroll_up() @@ -721,6 +723,10 @@ function app_launcher:get_current_page() return self._private.current_page end +function app_launcher:get_text() + return self._private.text +end + local function new(args) args = args or {}