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