From ce26c8a75460948bccf412b3c559ea9a5777131f Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Sat, 19 Jul 2025 14:25:39 +1000 Subject: feat: fzf-like search instead of fuzzy Also add license for fuzzysort lib --- services/Apps.qml | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'services') diff --git a/services/Apps.qml b/services/Apps.qml index 49b48fe..b8ec38e 100644 --- a/services/Apps.qml +++ b/services/Apps.qml @@ -1,25 +1,12 @@ pragma Singleton -import "root:/utils/scripts/fuzzysort.js" as Fuzzy +import qs.utils import Quickshell -Singleton { +Searcher { id: root - readonly property list list: DesktopEntries.applications.values.filter(a => !a.noDisplay).sort((a, b) => a.name.localeCompare(b.name)) - readonly property list preppedApps: list.map(a => ({ - name: Fuzzy.prepare(a.name), - comment: Fuzzy.prepare(a.comment), - entry: a - })) - - function fuzzyQuery(search: string): var { // Idk why list doesn't work - return Fuzzy.go(search, preppedApps, { - all: true, - keys: ["name", "comment"], - scoreFn: r => r[0].score > 0 ? r[0].score * 0.9 + r[1].score * 0.1 : 0 - }).map(r => r.obj.entry); - } + list: DesktopEntries.applications.values.filter(a => !a.noDisplay).sort((a, b) => a.name.localeCompare(b.name)) function launch(entry: DesktopEntry): void { if (entry.runInTerminal) -- cgit v1.2.3-freya