summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-07-27 22:59:45 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-07-27 22:59:45 +1000
commita3ca244c15056377ec33a3180ff9db881fe77c35 (patch)
treeabc76733e96269de887d4213295e891d05b1d4a6
parentinternal: fix busyindicator & switch (diff)
downloadcaelestia-shell-a3ca244c15056377ec33a3180ff9db881fe77c35.tar.gz
caelestia-shell-a3ca244c15056377ec33a3180ff9db881fe77c35.tar.bz2
caelestia-shell-a3ca244c15056377ec33a3180ff9db881fe77c35.zip
bar: add kb layout status icon
Closes #280
-rw-r--r--config/BarConfig.qml1
-rw-r--r--modules/bar/components/StatusIcons.qml17
-rw-r--r--services/Hyprland.qml14
3 files changed, 31 insertions, 1 deletions
diff --git a/config/BarConfig.qml b/config/BarConfig.qml
index 3f9f94d..498b2f5 100644
--- a/config/BarConfig.qml
+++ b/config/BarConfig.qml
@@ -22,6 +22,7 @@ JsonObject {
component Status: JsonObject {
property bool showAudio: false
+ property bool showKbLayout: false
property bool showNetwork: true
property bool showBluetooth: true
property bool showBattery: true
diff --git a/modules/bar/components/StatusIcons.qml b/modules/bar/components/StatusIcons.qml
index 45f943e..692f48f 100644
--- a/modules/bar/components/StatusIcons.qml
+++ b/modules/bar/components/StatusIcons.qml
@@ -63,6 +63,23 @@ Item {
}
}
+ // Keyboard layout icon
+ Loader {
+ id: kbLayout
+
+ Layout.alignment: Qt.AlignHCenter
+ asynchronous: true
+ active: Config.bar.status.showKbLayout
+ visible: active
+
+ sourceComponent: StyledText {
+ animate: true
+ text: Hyprland.kbLayout
+ color: root.colour
+ font.family: Appearance.font.family.mono
+ }
+ }
+
// Network icon
Loader {
id: networkIcon
diff --git a/services/Hyprland.qml b/services/Hyprland.qml
index 1385723..2b3fd32 100644
--- a/services/Hyprland.qml
+++ b/services/Hyprland.qml
@@ -2,6 +2,7 @@ pragma Singleton
import Quickshell
import Quickshell.Hyprland
+import Quickshell.Io
import QtQuick
Singleton {
@@ -14,6 +15,7 @@ Singleton {
readonly property HyprlandWorkspace focusedWorkspace: Hyprland.focusedWorkspace
readonly property HyprlandMonitor focusedMonitor: Hyprland.focusedMonitor
readonly property int activeWsId: focusedWorkspace?.id ?? 1
+ property string kbLayout: "?"
function dispatch(request: string): void {
Hyprland.dispatch(request);
@@ -27,7 +29,9 @@ Singleton {
if (n.endsWith("v2"))
return;
- if (["workspace", "moveworkspace", "activespecial", "focusedmon"].includes(n)) {
+ if (n === "activelayout") {
+ root.kbLayout = event.parse(2)[1];
+ } else if (["workspace", "moveworkspace", "activespecial", "focusedmon"].includes(n)) {
Hyprland.refreshWorkspaces();
Hyprland.refreshMonitors();
} else if (["openwindow", "closewindow", "movewindow"].includes(n)) {
@@ -42,4 +46,12 @@ Singleton {
}
}
}
+
+ Process {
+ running: true
+ command: ["hyprctl", "-j", "devices"]
+ stdout: StdioCollector {
+ onStreamFinished: root.kbLayout = JSON.parse(text).keyboards.find(k => k.main).layout
+ }
+ }
}