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 --- modules/launcher/Actions.qml | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'modules/launcher/Actions.qml') diff --git a/modules/launcher/Actions.qml b/modules/launcher/Actions.qml index 4572a61..0e658f0 100644 --- a/modules/launcher/Actions.qml +++ b/modules/launcher/Actions.qml @@ -1,18 +1,17 @@ pragma Singleton -import "root:/utils/scripts/fuzzysort.js" as Fuzzy import qs.services import qs.config +import qs.utils import Quickshell -import Quickshell.Io import QtQuick -Singleton { +Searcher { id: root property string qalcResult - readonly property list list: [ + readonly property list actions: [ Action { name: qsTr("Calculator") desc: qsTr("Do simple math equations (powered by Qalc)") @@ -134,24 +133,16 @@ Singleton { } ] - readonly property list preppedActions: list.filter(a => !a.disabled).map(a => ({ - name: Fuzzy.prepare(a.name), - desc: Fuzzy.prepare(a.desc), - action: a - })) - - function fuzzyQuery(search: string): var { - return Fuzzy.go(search.slice(Config.launcher.actionPrefix.length), preppedActions, { - all: true, - keys: ["name", "desc"], - scoreFn: r => r[0].score > 0 ? r[0].score * 0.9 + r[1].score * 0.1 : 0 - }).map(r => r.obj.action); + function transformSearch(search: string): string { + return search.slice(Config.launcher.actionPrefix.length); } function autocomplete(list: AppList, text: string): void { list.search.text = `${Config.launcher.actionPrefix}${text} `; } + list: actions.filter(a => !a.disabled) + component Action: QtObject { required property string name required property string desc -- cgit v1.2.3-freya