mirror of
https://github.com/end-4/dots-hyprland.git
synced 2026-06-05 14:59:27 -05:00
46 lines
1.0 KiB
QML
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)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|