summaryrefslogtreecommitdiff
path: root/pkgs/astal/src/widget/launcher.lua
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2025-06-20 09:18:21 -0400
committerFreya Murphy <freya@freyacat.org>2025-06-20 09:18:21 -0400
commitefa98e2fd8b2bada08da4da7d4eeff82b2003254 (patch)
tree9cbe6a4a14d71074cb767354ba6db5cd0a42f5b3 /pkgs/astal/src/widget/launcher.lua
parentnew astal app launcher, refactor astal build fn (diff)
downloaddotfiles-nix-efa98e2fd8b2bada08da4da7d4eeff82b2003254.tar.gz
dotfiles-nix-efa98e2fd8b2bada08da4da7d4eeff82b2003254.tar.bz2
dotfiles-nix-efa98e2fd8b2bada08da4da7d4eeff82b2003254.zip
switch astal to using builting IPC
Diffstat (limited to '')
-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