Files
dots-hyprland/dots/.config/quickshell/ii/services/HyprlandKeybinds.qml
T
2026-05-12 09:28:07 +02:00

46 lines
1.0 KiB
QML

pragma Singleton
pragma ComponentBehavior: Bound
import qs.modules.common
import qs.modules.common.functions
import QtQuick
import Quickshell
import Quickshell.Io
import Quickshell.Hyprland
/**
* A service that provides access to Hyprland keybinds.
* Uses the `get_keybinds.py` script to parse comments in config files in a certain format and convert to JSON.
*/
Singleton {
id: root
property var keybinds: []
Connections {
target: Hyprland
function onRawEvent(event) {
if (event.name == "configreloaded") {
getKeybinds.running = true
}
}
}
Process {
id: getKeybinds
running: true
command: ["hyprctl", "binds", "-j"]
stdout: StdioCollector {
onStreamFinished: {
try {
root.keybinds = JSON.parse(text)
} catch (e) {
console.error("[CheatsheetKeybinds] Error parsing keybinds:", e)
}
}
}
}
}