aboutsummaryrefslogtreecommitdiffstats
path: root/config/quickshell/services/HyprlandKeybinds.qml
diff options
context:
space:
mode:
authorKiran George <kirangeorge1995@gmail.com>2025-06-09 11:30:08 +0530
committerKiran George <kirangeorge1995@gmail.com>2025-06-09 11:30:08 +0530
commit952aa63147c9fb28f6ace6f0bc7ccf45ced1299a (patch)
tree306e6d86603a162c00bc5113b56baac0fe7bec7c /config/quickshell/services/HyprlandKeybinds.qml
parent4cf0d0bd5930da76e60f6770de3ee97c10ca7024 (diff)
Overview v2
Diffstat (limited to 'config/quickshell/services/HyprlandKeybinds.qml')
-rw-r--r--config/quickshell/services/HyprlandKeybinds.qml73
1 files changed, 73 insertions, 0 deletions
diff --git a/config/quickshell/services/HyprlandKeybinds.qml b/config/quickshell/services/HyprlandKeybinds.qml
new file mode 100644
index 00000000..189ba76d
--- /dev/null
+++ b/config/quickshell/services/HyprlandKeybinds.qml
@@ -0,0 +1,73 @@
+pragma Singleton
+pragma ComponentBehavior: Bound
+
+import "root:/modules/common"
+import "root:/modules/common/functions/file_utils.js" as FileUtils
+import QtQuick
+import Quickshell
+import Quickshell.Io
+import Quickshell.Wayland
+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 string keybindParserPath: FileUtils.trimFileProtocol(`${Directories.config}/quickshell/scripts/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 ?? []),
+ ]
+ })
+
+ Connections {
+ target: Hyprland
+
+ function onRawEvent(event) {
+ if (event.name == "configreloaded") {
+ getDefaultKeybinds.running = true
+ getUserKeybinds.running = true
+ }
+ }
+ }
+
+ Process {
+ id: getDefaultKeybinds
+ running: true
+ command: [root.keybindParserPath, "--path", root.defaultKeybindConfigPath,]
+
+ stdout: SplitParser {
+ onRead: data => {
+ 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)
+ } catch (e) {
+ console.error("[CheatsheetKeybinds] Error parsing keybinds:", e)
+ }
+ }
+ }
+ }
+}
+
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage