forked from Shinonome/dots-hyprland
qs: cheatsheet: display categories nicely
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user