fix(window-title): shrink group to content width instead of always filling max

This commit is contained in:
Damocles 2026-04-17 09:31:55 +02:00
parent 69e3711aec
commit 20159f0514
2 changed files with 10 additions and 2 deletions

View file

@ -16,6 +16,11 @@ M.BarSection {
return entry ? Quickshell.iconPath(entry.icon) : "";
}
readonly property real _iconOffset: _icon.visible ? _icon.width + root.spacing : 0
// Natural content width Bar.qml uses this to cap the group width
implicitWidth: _iconOffset + _label.implicitWidth
IconImage {
id: _icon
visible: root._iconSource !== ""
@ -30,10 +35,11 @@ M.BarSection {
}
M.BarLabel {
id: _label
label: M.NiriIpc.focusedTitle
color: root.accentColor
elide: Text.ElideRight
anchors.verticalCenter: parent.verticalCenter
width: root.width - (_icon.visible ? _icon.width + root.spacing : 0)
width: Math.min(implicitWidth, Math.max(0, root.width - root._iconOffset))
}
}