summaryrefslogtreecommitdiff
path: root/pkgs/astal/src/widget/launcher.lua
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/astal/src/widget/launcher.lua')
-rw-r--r--pkgs/astal/src/widget/launcher.lua16
1 files changed, 10 insertions, 6 deletions
diff --git a/pkgs/astal/src/widget/launcher.lua b/pkgs/astal/src/widget/launcher.lua
index cbac6c3..ac69d65 100644
--- a/pkgs/astal/src/widget/launcher.lua
+++ b/pkgs/astal/src/widget/launcher.lua
@@ -15,6 +15,7 @@ local FlowBoxChild = astalify(Gtk.FlowBoxChild)
local apps = Apps.Apps()
local text = Variable("")
+local visible = Variable(false)
local list = text(function(text)
return lib.slice(apps:exact_query(text), 0, MAX_ENTRIES)
end)
@@ -23,13 +24,13 @@ function on_show()
text:set("")
end
-function close()
- App:quit()
+function hide()
+ visible:set(false)
end
function on_key_press(self, event)
if event.keyval == Gdk.KEY_Escape then
- close()
+ hide()
end
end
@@ -37,7 +38,7 @@ function on_enter()
local found = apps:exact_query(text:get())[1]
if found then
found:launch()
- close()
+ hide()
end
end
@@ -47,7 +48,7 @@ function Application(app)
class_name = "app",
on_clicked = function()
app:launch()
- close()
+ hide()
end,
Widget.Box({
halign = "CENTER",
@@ -100,7 +101,7 @@ end
return function()
local Anchor = astal.require('Astal').WindowAnchor
- return Widget.Window({
+ Widget.Window({
class_name = "launcher",
anchor = Anchor.TOP + Anchor.BOTTOM + Anchor.LEFT + Anchor.RIGHT,
exclusivity = "EXCLUSIVE",
@@ -108,6 +109,9 @@ return function()
application = App,
on_show = on_show,
on_key_press_event = on_key_press,
+ visible = visible(),
Launcher(),
})
+
+ return visible
end