import { Astal, Gdk, Gtk } from "ags/gtk4"; import { execApp, getAppIcon, getApps, getAstalApps } from "../../modules/apps"; import { getPopupWindowContainer, PopupWindow } from "../../widget/PopupWindow"; import AstalApps from "gi://AstalApps"; import Pango from "gi://Pango?version=1.0"; import { createState, For } from "ags"; import { escapeUnintendedMarkup } from "../../modules/utils"; const ignoredKeys = [ Gdk.KEY_Right, Gdk.KEY_Down, Gdk.KEY_Up, Gdk.KEY_Shift_L, Gdk.KEY_Shift_R, Gdk.KEY_Shift_Lock, Gdk.KEY_Left, Gdk.KEY_Return, Gdk.KEY_space ]; export const AppsWindow = (mon: number) => { const [results, setResults] = createState(getApps() as Array); return { const entry = getPopupWindowContainer(self).get_first_child()! .get_first_child()!.get_first_child()! as Gtk.SearchEntry; for(const ignoredKey of ignoredKeys) if(key === ignoredKey) return entry.grab_focus(); }}> { setResults(getAstalApps().fuzzy_query(self.text.trim())); }} onStopSearch={(self) => (self.get_root() as Astal.Window)?.close()} /> child.get_child()!.activate() // pass activation to button }> {(app) => ${ escapeUnintendedMarkup(app.description) }` : ""}` } onActivate={(self) => { execApp(app); (self.get_root() as Astal.Window)?.close(); }} onClicked={(self) => { execApp(app); (self.get_root() as Astal.Window)?.close(); }}> } }