dots-hyprland/.config/quickshell/services/AppSearch.qml
2025-05-03 15:49:01 +02:00

22 lines
676 B
QML

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);
}
}