diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-08-19 17:30:33 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-08-19 17:30:33 +1000 |
| commit | 660f09959d90afa77b38f46cb7b818f007f99eae (patch) | |
| tree | 011f797114c74764a65435e7835015c1b5830c89 | |
| parent | lock: better pfp fallback (diff) | |
| download | caelestia-shell-660f09959d90afa77b38f46cb7b818f007f99eae.tar.gz caelestia-shell-660f09959d90afa77b38f46cb7b818f007f99eae.tar.bz2 caelestia-shell-660f09959d90afa77b38f46cb7b818f007f99eae.zip | |
bar: add kblayout popout
| -rw-r--r-- | modules/bar/components/StatusIcons.qml | 6 | ||||
| -rw-r--r-- | modules/bar/popouts/Content.qml | 5 | ||||
| -rw-r--r-- | modules/bar/popouts/KbLayout.qml | 6 | ||||
| -rw-r--r-- | services/Hyprland.qml | 7 |
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 } } } |