summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Friesen <57829844+Gitkubikon@users.noreply.github.com>2025-10-23 10:35:45 +0200
committerGitHub <noreply@github.com>2025-10-23 19:35:45 +1100
commit223207235e41e3476aefae4e9f4a8724dcd02e8b (patch)
tree330b39652addf0128892206b96a1cc6f1384b857
parentbar/popouts: allow disabling individual popouts (diff)
downloadcaelestia-shell-223207235e41e3476aefae4e9f4a8724dcd02e8b.tar.gz
caelestia-shell-223207235e41e3476aefae4e9f4a8724dcd02e8b.tar.bz2
caelestia-shell-223207235e41e3476aefae4e9f4a8724dcd02e8b.zip
hypr: account for kb layout variants (#836)
Refactor layout and variant parsing logic in Hypr.qml to improve readability and maintainability.
-rw-r--r--services/Hypr.qml30
1 files changed, 23 insertions, 7 deletions
diff --git a/services/Hypr.qml b/services/Hypr.qml
index f537792..a654fdd 100644
--- a/services/Hypr.qml
+++ b/services/Hypr.qml
@@ -110,14 +110,30 @@ Singleton {
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 layoutMatch = text().match(/! layout\n([\s\S]*?)\n\n/);
+ if (layoutMatch) {
+ const lines = layoutMatch[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]);
+ const match = line.match(/^\s*([a-z]{2,})\s+([a-zA-Z() ]+)$/);
+ if (match)
+ root.kbMap.set(match[2], match[1]);
+ }
+ }
+
+ const variantMatch = text().match(/! variant\n([\s\S]*?)\n\n/);
+ if (variantMatch) {
+ const lines = variantMatch[1].split("\n");
+ for (const line of lines) {
+ if (!line.trim() || line.trim().startsWith("!"))
+ continue;
+
+ const match = line.match(/^\s*([a-zA-Z0-9_-]+)\s+([a-z]{2,}): (.+)$/);
+ if (match)
+ root.kbMap.set(match[3], match[2]);
+ }
}
}
}