From 0859d752560ad6cb8b99de8bdccc034eeee9f988 Mon Sep 17 00:00:00 2001 From: nrand Date: Thu, 18 Sep 2025 15:03:09 +0300 Subject: [PATCH 1/3] bar: fixed kb layout+variant display in top right --- .../quickshell/ii/services/HyprlandXkb.qml | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/.config/quickshell/ii/services/HyprlandXkb.qml b/.config/quickshell/ii/services/HyprlandXkb.qml index cace0d29e..2d9d408e2 100644 --- a/.config/quickshell/ii/services/HyprlandXkb.qml +++ b/.config/quickshell/ii/services/HyprlandXkb.qml @@ -46,13 +46,24 @@ Singleton { if (!line.trim() || line.trim().startsWith('!')) return false; - // Match: key + whitespace + description - const match = line.match(/^\s*(\S+)\s+(.+)$/); - if (match && match[2] === targetDescription) { - root.cachedLayoutCodes[match[2]] = match[1]; - root.currentLayoutCode = match[1]; + // Match layout: (whitespace + ) key + whitespace + description + const matchLayout = line.match(/^\s*(\S+)\s+(.+)$/); + if (matchLayout && matchLayout[2] === targetDescription) { + root.cachedLayoutCodes[matchLayout[2]] = matchLayout[1]; + root.currentLayoutCode = matchLayout[1]; return true; } + + // Match variant: (whitespace + ) variant + whitespace + key + whitespace + description + const matchVariant = line.match(/^\s*(\S+)\s+(\S+)\s+(.+)$/); + if (matchVariant && matchVariant[3] === targetDescription) { + const complexLayout = matchVariant[2] + " " + matchVariant[1]; + root.cachedLayoutCodes[matchVariant[3]] = complexLayout; + root.currentLayourCode = complexLayout; + return true; + } + + return false; }); // console.log("[HyprlandXkb] Found line:", foundLine); // console.log("[HyprlandXkb] Layout:", root.currentLayoutName, "| Code:", root.currentLayoutCode); From ed56d03c0980c870c1ae67668b1bf45fd8aa4ffd Mon Sep 17 00:00:00 2001 From: nrand Date: Fri, 19 Sep 2025 07:58:12 +0300 Subject: [PATCH 2/3] bar: actually fixed it (there was a typo oopsie) --- .config/quickshell/ii/services/HyprlandXkb.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/quickshell/ii/services/HyprlandXkb.qml b/.config/quickshell/ii/services/HyprlandXkb.qml index 2d9d408e2..54c8f8f8b 100644 --- a/.config/quickshell/ii/services/HyprlandXkb.qml +++ b/.config/quickshell/ii/services/HyprlandXkb.qml @@ -59,7 +59,7 @@ Singleton { if (matchVariant && matchVariant[3] === targetDescription) { const complexLayout = matchVariant[2] + " " + matchVariant[1]; root.cachedLayoutCodes[matchVariant[3]] = complexLayout; - root.currentLayourCode = complexLayout; + root.currentLayoutCode = complexLayout; return true; } From 5d1a3fe6a70c714866b3eeeea7f8346fbd04a3a1 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Sat, 20 Sep 2025 13:02:18 +0200 Subject: [PATCH 3/3] hyprland xkb layout indicator: fix weird placement on vertical bar --- .../quickshell/ii/modules/bar/BarContent.qml | 16 +++++++++++----- .../modules/verticalBar/VerticalBarContent.qml | 17 ++++++++++++----- .config/quickshell/ii/services/HyprlandXkb.qml | 2 +- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/.config/quickshell/ii/modules/bar/BarContent.qml b/.config/quickshell/ii/modules/bar/BarContent.qml index 7e1e885c0..b17fda1e9 100644 --- a/.config/quickshell/ii/modules/bar/BarContent.qml +++ b/.config/quickshell/ii/modules/bar/BarContent.qml @@ -293,11 +293,17 @@ Item { // Bar content region active: HyprlandXkb.layoutCodes.length > 1 visible: active Layout.rightMargin: indicatorsRowLayout.realSpacing - sourceComponent: StyledText { - text: HyprlandXkb.currentLayoutCode - font.pixelSize: Appearance.font.pixelSize.small - color: rightSidebarButton.colText - animateChange: true + sourceComponent: Item { + implicitWidth: layoutCodeText.implicitWidth + StyledText { + id: layoutCodeText + anchors.centerIn: parent + horizontalAlignment: Text.AlignHCenter + text: HyprlandXkb.currentLayoutCode.split(":").join("\n") + font.pixelSize: text.includes("\n") ? Appearance.font.pixelSize.smaller : Appearance.font.pixelSize.small + color: rightSidebarButton.colText + animateChange: true + } } } MaterialSymbol { diff --git a/.config/quickshell/ii/modules/verticalBar/VerticalBarContent.qml b/.config/quickshell/ii/modules/verticalBar/VerticalBarContent.qml index bfcd0c6fb..5b4053e64 100644 --- a/.config/quickshell/ii/modules/verticalBar/VerticalBarContent.qml +++ b/.config/quickshell/ii/modules/verticalBar/VerticalBarContent.qml @@ -273,11 +273,18 @@ Item { // Bar content region active: HyprlandXkb.layoutCodes.length > 1 visible: active Layout.bottomMargin: indicatorsColumnLayout.realSpacing - sourceComponent: StyledText { - text: HyprlandXkb.currentLayoutCode - font.pixelSize: Appearance.font.pixelSize.small - color: rightSidebarButton.colText - animateChange: true + Layout.alignment: Qt.AlignHCenter + sourceComponent: Item { + implicitHeight: layoutCodeText.implicitHeight + StyledText { + id: layoutCodeText + anchors.centerIn: parent + horizontalAlignment: Text.AlignHCenter + text: HyprlandXkb.currentLayoutCode.split(":").join("\n") + font.pixelSize: text.includes("\n") ? Appearance.font.pixelSize.smaller : Appearance.font.pixelSize.small + color: rightSidebarButton.colText + animateChange: true + } } } MaterialSymbol { diff --git a/.config/quickshell/ii/services/HyprlandXkb.qml b/.config/quickshell/ii/services/HyprlandXkb.qml index 54c8f8f8b..1aa52ec54 100644 --- a/.config/quickshell/ii/services/HyprlandXkb.qml +++ b/.config/quickshell/ii/services/HyprlandXkb.qml @@ -57,7 +57,7 @@ Singleton { // Match variant: (whitespace + ) variant + whitespace + key + whitespace + description const matchVariant = line.match(/^\s*(\S+)\s+(\S+)\s+(.+)$/); if (matchVariant && matchVariant[3] === targetDescription) { - const complexLayout = matchVariant[2] + " " + matchVariant[1]; + const complexLayout = matchVariant[2] + matchVariant[1]; root.cachedLayoutCodes[matchVariant[3]] = complexLayout; root.currentLayoutCode = complexLayout; return true;