summaryrefslogtreecommitdiff
path: root/modules/launcher/Actions.qml
diff options
context:
space:
mode:
Diffstat (limited to 'modules/launcher/Actions.qml')
-rw-r--r--modules/launcher/Actions.qml23
1 files changed, 7 insertions, 16 deletions
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<Action> list: [
+ readonly property list<Action> actions: [
Action {
name: qsTr("Calculator")
desc: qsTr("Do simple math equations (powered by Qalc)")
@@ -134,24 +133,16 @@ Singleton {
}
]
- readonly property list<var> 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