truncate xkb variants to avoid text overflow (#2032)

This commit is contained in:
end-4
2025-09-28 08:26:29 +02:00
committed by GitHub
@@ -6,10 +6,16 @@ import qs.modules.common.widgets
Loader {
id: root
property bool vertical: false
active: HyprlandXkb.layoutCodes.length > 1
visible: active
function abbreviateLayoutCode(fullCode) {
return fullCode.split(':').map(layout => {
const baseLayout = layout.split('-')[0];
return baseLayout.slice(0, 4);
}).join('\n');
}
sourceComponent: Item {
implicitWidth: root.vertical ? null : layoutCodeText.implicitWidth
implicitHeight: root.vertical ? layoutCodeText.implicitHeight : null
@@ -18,7 +24,7 @@ Loader {
id: layoutCodeText
anchors.centerIn: parent
horizontalAlignment: Text.AlignHCenter
text: HyprlandXkb.currentLayoutCode.split(":").join("\n")
text: abbreviateLayoutCode(HyprlandXkb.currentLayoutCode)
font.pixelSize: text.includes("\n") ? Appearance.font.pixelSize.smallie : Appearance.font.pixelSize.small
color: rightSidebarButton.colText
animateChange: true