summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/bar/components/StatusIcons.qml6
-rw-r--r--modules/bar/popouts/Content.qml5
-rw-r--r--modules/bar/popouts/KbLayout.qml6
-rw-r--r--services/Hyprland.qml7
4 files changed, 17 insertions, 7 deletions
diff --git a/modules/bar/components/StatusIcons.qml b/modules/bar/components/StatusIcons.qml
index 7db79c7..f1e3ffe 100644
--- a/modules/bar/components/StatusIcons.qml
+++ b/modules/bar/components/StatusIcons.qml
@@ -42,11 +42,9 @@ StyledRect {
}
// Keyboard layout icon
- Loader {
- Layout.alignment: Qt.AlignHCenter
- asynchronous: true
+ WrappedLoader {
+ name: "kblayout"
active: Config.bar.status.showKbLayout
- visible: active
sourceComponent: StyledText {
animate: true
diff --git a/modules/bar/popouts/Content.qml b/modules/bar/popouts/Content.qml
index 453611c..b8fcbc5 100644
--- a/modules/bar/popouts/Content.qml
+++ b/modules/bar/popouts/Content.qml
@@ -52,6 +52,11 @@ Item {
}
}
+ Popout {
+ name: "kblayout"
+ source: "KbLayout.qml"
+ }
+
Repeater {
model: ScriptModel {
values: [...SystemTray.items.values]
diff --git a/modules/bar/popouts/KbLayout.qml b/modules/bar/popouts/KbLayout.qml
new file mode 100644
index 0000000..ea7c490
--- /dev/null
+++ b/modules/bar/popouts/KbLayout.qml
@@ -0,0 +1,6 @@
+import qs.components
+import qs.services
+
+StyledText {
+ text: qsTr("Keyboard layout: %1").arg(Hyprland.kbLayoutFull)
+}
diff --git a/services/Hyprland.qml b/services/Hyprland.qml
index 78b5453..d911710 100644
--- a/services/Hyprland.qml
+++ b/services/Hyprland.qml
@@ -15,7 +15,8 @@ Singleton {
readonly property HyprlandWorkspace focusedWorkspace: Hyprland.focusedWorkspace
readonly property HyprlandMonitor focusedMonitor: Hyprland.focusedMonitor
readonly property int activeWsId: focusedWorkspace?.id ?? 1
- property string kbLayout: "?"
+ readonly property string kbLayout: kbLayoutFull.slice(0, 2).toLowerCase()
+ property string kbLayoutFull: "?"
function dispatch(request: string): void {
Hyprland.dispatch(request);
@@ -34,7 +35,7 @@ Singleton {
return;
if (n === "activelayout") {
- root.kbLayout = event.parse(2)[1].slice(0, 2).toLowerCase();
+ root.kbLayoutFull = event.parse(2)[1];
} else if (["workspace", "moveworkspace", "activespecial", "focusedmon"].includes(n)) {
Hyprland.refreshWorkspaces();
Hyprland.refreshMonitors();
@@ -55,7 +56,7 @@ Singleton {
running: true
command: ["hyprctl", "-j", "devices"]
stdout: StdioCollector {
- onStreamFinished: root.kbLayout = JSON.parse(text).keyboards.find(k => k.main).active_keymap.slice(0, 2).toLowerCase()
+ onStreamFinished: root.kbLayoutFull = JSON.parse(text).keyboards.find(k => k.main).active_keymap
}
}
}