diff options
Diffstat (limited to 'services/Apps.qml')
| -rw-r--r-- | services/Apps.qml | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/services/Apps.qml b/services/Apps.qml new file mode 100644 index 0000000..3f9fb73 --- /dev/null +++ b/services/Apps.qml @@ -0,0 +1,42 @@ +pragma Singleton + +import "fuzzysort.js" as Fuzzy +import "root:/widgets" +import "root:/config" +import Quickshell +import Quickshell.Io +import QtQuick + +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.createObject(root, { + entry + }); + } + + Component { + id: launchProc + + Process { + required property DesktopEntry entry + + running: true + command: ["app2unit", "--", `${entry.id}.desktop`] + } + } +} |