qs: cheatsheet: display categories nicely

This commit is contained in:
end-4
2026-05-14 09:37:45 +02:00
parent 2ade168a20
commit d1daedc6d2
3 changed files with 193 additions and 140 deletions
@@ -15,6 +15,7 @@ import Quickshell.Hyprland
Singleton {
id: root
property var keybinds: []
property var keybindCategories: []
Connections {
target: Hyprland
@@ -35,6 +36,15 @@ Singleton {
onStreamFinished: {
try {
root.keybinds = JSON.parse(text)
var groups = []
for (var i = 0; i < root.keybinds.length; i++) {
var bind = root.keybinds[i].description
var group = bind.substring(0, bind.indexOf(":"))
if (!groups.includes(group) && group.length > 0) {
groups.push(group)
}
}
root.keybindCategories = groups
} catch (e) {
console.error("[CheatsheetKeybinds] Error parsing keybinds:", e)
}