import { App, Astal, Gtk, Gdk } from "astal/gtk4" import { Variable } from "astal" function hide() { App.get_window("launcher")!.hide() } export default function Launcher(monitor: Gdk.Monitor) { const { CENTER } = Gtk.Align const apps = new Apps.Apps() const width = Variable(1000) const text = Variable("") const list = text(text => apps.fuzzy_query(text).slice(0, MAX_ITEMS)) const onEnter = () => { apps.fuzzy_query(text.get())?.[0].launch() hide() } return { text.set("") width.set(self.get_current_monitor().workarea.width) }} onKeyPressEvent={function (self, event: Gdk.KeyEvent) { if (event.get_keyval() === Gdk.KEY_Escape) self.hide() }}> w / 2)} expand onClick={hide} /> text.set(self.text)} onActivate={onEnter} /> {list.as(list => list.map(app => ( )))} l.length === 0)}> w / 2)} expand onClick={hide} /> }