From 20159f05147c70e326a7faf18e9f8cbf0a2641bc Mon Sep 17 00:00:00 2001 From: Damocles Date: Fri, 17 Apr 2026 09:31:55 +0200 Subject: [PATCH] fix(window-title): shrink group to content width instead of always filling max --- modules/Bar.qml | 4 +++- modules/WindowTitle.qml | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/Bar.qml b/modules/Bar.qml index b6c5a23..d542b85 100644 --- a/modules/Bar.qml +++ b/modules/Bar.qml @@ -146,7 +146,9 @@ PanelWindow { clip: true visible: M.Modules.windowTitle.enable && M.NiriIpc.focusedTitle !== "" M.WindowTitle { - width: Math.max(0, centerSection.x - _windowTitleGroup.x - 2 * M.Theme.groupPadding - M.Theme.groupSpacing) + id: _windowTitle + readonly property real _maxWidth: Math.max(0, centerSection.x - _windowTitleGroup.x - 2 * M.Theme.groupPadding - M.Theme.groupSpacing) + width: Math.min(implicitWidth, _maxWidth) } } Item { diff --git a/modules/WindowTitle.qml b/modules/WindowTitle.qml index ebb7bdf..a22856c 100644 --- a/modules/WindowTitle.qml +++ b/modules/WindowTitle.qml @@ -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)) } }