launcher: fuzzy search

This commit is contained in:
end-4
2025-05-03 15:49:01 +02:00
parent 1beb723cf3
commit 4a44d78389
6 changed files with 730 additions and 16 deletions
+22
View File
@@ -0,0 +1,22 @@
pragma Singleton
import "root:/modules/common/functions/fuzzysort.js" as Fuzzy
import Quickshell
import Quickshell.Io
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);
}
}