fix keybind cheatsheet

This commit is contained in:
end-4
2026-05-12 09:28:07 +02:00
parent 807c761ed0
commit ae7f6bd165
2 changed files with 99 additions and 170 deletions
@@ -14,54 +14,27 @@ import Quickshell.Hyprland
*/
Singleton {
id: root
property string keybindParserPath: FileUtils.trimFileProtocol(`${Directories.scriptPath}/hyprland/get_keybinds.py`)
property string defaultKeybindConfigPath: FileUtils.trimFileProtocol(`${Directories.config}/hypr/hyprland/keybinds.conf`)
property string userKeybindConfigPath: FileUtils.trimFileProtocol(`${Directories.config}/hypr/custom/keybinds.conf`)
property var defaultKeybinds: {"children": []}
property var userKeybinds: {"children": []}
property var keybinds: ({
children: [
...(defaultKeybinds.children ?? []),
...(userKeybinds.children ?? []),
]
})
property var keybinds: []
Connections {
target: Hyprland
function onRawEvent(event) {
if (event.name == "configreloaded") {
getDefaultKeybinds.running = true
getUserKeybinds.running = true
getKeybinds.running = true
}
}
}
Process {
id: getDefaultKeybinds
id: getKeybinds
running: true
command: [root.keybindParserPath, "--path", root.defaultKeybindConfigPath]
command: ["hyprctl", "binds", "-j"]
stdout: SplitParser {
onRead: data => {
stdout: StdioCollector {
onStreamFinished: {
try {
root.defaultKeybinds = JSON.parse(data)
} catch (e) {
console.error("[CheatsheetKeybinds] Error parsing keybinds:", e)
}
}
}
}
Process {
id: getUserKeybinds
running: true
command: [root.keybindParserPath, "--path", root.userKeybindConfigPath]
stdout: SplitParser {
onRead: data => {
try {
root.userKeybinds = JSON.parse(data)
root.keybinds = JSON.parse(text)
} catch (e) {
console.error("[CheatsheetKeybinds] Error parsing keybinds:", e)
}