summaryrefslogtreecommitdiff
path: root/modules/launcher/Actions.qml
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-07-19 14:25:39 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-07-19 14:25:39 +1000
commitce26c8a75460948bccf412b3c559ea9a5777131f (patch)
tree3ad3aed7243298f27d85f50434f0619e7eb34f3d /modules/launcher/Actions.qml
parentreadme: update config example (diff)
downloadcaelestia-shell-ce26c8a75460948bccf412b3c559ea9a5777131f.tar.gz
caelestia-shell-ce26c8a75460948bccf412b3c559ea9a5777131f.tar.bz2
caelestia-shell-ce26c8a75460948bccf412b3c559ea9a5777131f.zip
feat: fzf-like search instead of fuzzy
Also add license for fuzzysort lib
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