nosignal-shell/services/Apps.qml
2 * r + 2 * t 587c3a7bc9 feat: launcher keyboard nav
Using currentitem and highlight
Also fix not closing launcher when clicking app
Apps service use only one process
2025-05-02 23:35:22 +10:00

37 lines
977 B
QML

pragma Singleton
import "root:/utils/scripts/fuzzysort.js" as Fuzzy
import "root:/widgets"
import "root:/config"
import Quickshell
import Quickshell.Io
Singleton {
id: root
readonly property list<DesktopEntry> list: DesktopEntries.applications.values.filter(a => !a.noDisplay).sort((a, b) => a.name.localeCompare(b.name))
readonly property list<var> preppedNames: list.map(a => ({
name: Fuzzy.prepare(a.name),
entry: a
}))
function fuzzyQuery(search: string): var { // Idk why list<DesktopEntry> doesn't work
return Fuzzy.go(search, preppedNames, {
all: true,
key: "name"
}).map(r => r.obj.entry);
}
function launch(entry: DesktopEntry): void {
launchProc.entry = entry;
launchProc.startDetached();
}
Process {
id: launchProc
property DesktopEntry entry
command: ["app2unit", "--", `${entry.id}.desktop`]
}
}