From e5d19bd3abc9271c7e1f7de7ff9f24aaf0443f7a Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Sat, 21 Nov 2026 15:35:35 +0100 Subject: [PATCH] quickshell: fix window title overflow --- quickshell/components/Bar/Bar.qml | 35 ++++++++++++------- .../components/WindowTitle/WindowTitle.qml | 6 ++++ 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/quickshell/components/Bar/Bar.qml b/quickshell/components/Bar/Bar.qml index 55fa817..679f643 100644 --- a/quickshell/components/Bar/Bar.qml +++ b/quickshell/components/Bar/Bar.qml @@ -26,20 +26,29 @@ PanelWindow { right: true } - BarSection { - id: leftContainer - anchors.left: parent.left - anchors.leftMargin: root.marginLeft - } + Item { + anchors.fill: parent - BarSection { - id: centerContainer - anchors.horizontalCenter: parent.horizontalCenter - } + BarSection { + id: leftContainer + anchors.left: parent.left + anchors.leftMargin: root.marginLeft + } - BarSection { - id: rightContainer - anchors.right: parent.right - anchors.rightMargin: root.marginRight + BarSection { + id: centerContainer + anchors.horizontalCenter: parent.horizontalCenter + width: Math.min(implicitWidth, Math.max(0, 2 * Math.min( + parent.width / 2 - (leftContainer.x + leftContainer.width), + rightContainer.x - parent.width / 2 + ))) + clip: true + } + + BarSection { + id: rightContainer + anchors.right: parent.right + anchors.rightMargin: root.marginRight + } } } diff --git a/quickshell/components/WindowTitle/WindowTitle.qml b/quickshell/components/WindowTitle/WindowTitle.qml index e4a2340..931a208 100644 --- a/quickshell/components/WindowTitle/WindowTitle.qml +++ b/quickshell/components/WindowTitle/WindowTitle.qml @@ -1,6 +1,7 @@ import Quickshell import Quickshell.Hyprland import QtQuick +import QtQuick.Layouts Item { property int paddingY: 4 @@ -11,6 +12,8 @@ Item { implicitWidth: label.implicitWidth + root.paddingX implicitHeight: label.implicitHeight + root.paddingY + Layout.minimumWidth: 0 + Layout.fillWidth: true SystemPalette { id: pal } @@ -22,8 +25,11 @@ Item { Text { id: label anchors.centerIn: parent + width: Math.max(0, parent.width - root.paddingX) text: Hyprland.activeToplevel?.title ?? "" + // text: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" color: pal.text + elide: Text.ElideRight } } }