diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-05-02 20:05:52 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-05-02 20:05:52 +1000 |
| commit | 8a32dd8614ada54c3f8024fc8774ed960bfa46d4 (patch) | |
| tree | ef5fd051a6cccc42be2b33b4ad49eda20eba84a8 /services/Apps.qml | |
| parent | launcher: better app items (diff) | |
| download | caelestia-shell-8a32dd8614ada54c3f8024fc8774ed960bfa46d4.tar.gz caelestia-shell-8a32dd8614ada54c3f8024fc8774ed960bfa46d4.tar.bz2 caelestia-shell-8a32dd8614ada54c3f8024fc8774ed960bfa46d4.zip | |
launcher: fuzzy sort
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`] + } + } +} |