summaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
Diffstat (limited to 'services')
-rw-r--r--services/Hypr.qml20
1 files changed, 19 insertions, 1 deletions
diff --git a/services/Hypr.qml b/services/Hypr.qml
index 0f31453..249f5ae 100644
--- a/services/Hypr.qml
+++ b/services/Hypr.qml
@@ -22,8 +22,9 @@ Singleton {
readonly property HyprlandMonitor focusedMonitor: Hyprland.focusedMonitor
readonly property int activeWsId: focusedWorkspace?.id ?? 1
- readonly property string kbLayout: kbLayoutFull.slice(0, 2).toLowerCase()
+ readonly property string kbLayout: kbMap.get(kbLayoutFull) ?? "??"
property string kbLayoutFull: "?"
+ property var kbMap: new Map()
function dispatch(request: string): void {
Hyprland.dispatch(request);
@@ -59,6 +60,23 @@ Singleton {
}
}
+ FileView {
+ id: kbLayoutFile
+
+ path: Quickshell.env("CAELESTIA_XKB_RULES_PATH") || "/usr/share/X11/xkb/rules/base.lst"
+ onLoaded: {
+ const lines = text().match(/! layout\n([\s\S]*?)\n\n/)[1].split("\n");
+ for (const line of lines) {
+ if (!line.trim() || line.trim().startsWith("!"))
+ continue;
+
+ const match = line.match(/^\s*([a-z]{2,})\s+([a-zA-Z() ]+)$/);
+ if (match)
+ root.kbMap.set(match[2], match[1]);
+ }
+ }
+ }
+
Process {
running: true
command: ["hyprctl", "-j", "devices"]