From 7f9dc766982136fac59b879988e5cf0319e1a31d Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Sun, 27 Apr 2025 20:35:01 +0200 Subject: [PATCH] bar: cleaner width --- .config/quickshell/modules/bar/ActiveWindow.qml | 9 +++++---- .config/quickshell/modules/bar/Bar.qml | 4 +++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.config/quickshell/modules/bar/ActiveWindow.qml b/.config/quickshell/modules/bar/ActiveWindow.qml index a675240a..446bdb07 100644 --- a/.config/quickshell/modules/bar/ActiveWindow.qml +++ b/.config/quickshell/modules/bar/ActiveWindow.qml @@ -9,7 +9,6 @@ Item { required property var bar readonly property HyprlandMonitor monitor: Hyprland.monitorFor(bar.screen) readonly property Toplevel activeWindow: ToplevelManager.activeToplevel - property int preferredWidth: Appearance.sizes.barPreferredSideSectionWidth height: parent.height width: colLayout.width @@ -19,21 +18,23 @@ Item { ColumnLayout { id: colLayout - anchors.centerIn: parent + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.right: parent.right spacing: -4 StyledText { + Layout.fillWidth: true font.pixelSize: Appearance.font.pixelSize.smaller color: Appearance.colors.colSubtext - Layout.preferredWidth: preferredWidth elide: Text.ElideRight text: activeWindow?.activated ? activeWindow?.appId : qsTr("Desktop") } StyledText { + Layout.fillWidth: true font.pixelSize: Appearance.font.pixelSize.small color: Appearance.colors.colOnLayer0 - Layout.preferredWidth: preferredWidth elide: Text.ElideRight text: activeWindow?.activated ? activeWindow?.title : `${qsTr("Workspace")} ${monitor.activeWorkspace?.id}` } diff --git a/.config/quickshell/modules/bar/Bar.qml b/.config/quickshell/modules/bar/Bar.qml index d3a06efc..718b79a1 100644 --- a/.config/quickshell/modules/bar/Bar.qml +++ b/.config/quickshell/modules/bar/Bar.qml @@ -70,8 +70,10 @@ Scope { id: leftSection anchors.left: parent.left implicitHeight: barHeight + width: (barRoot.width - middleSection.width) / 2 ActiveWindow { + Layout.fillWidth: true bar: barRoot } } @@ -134,7 +136,7 @@ Scope { id: rightSection anchors.right: parent.right implicitHeight: barHeight - width: Appearance.sizes.barPreferredSideSectionWidth + width: (barRoot.width - middleSection.width) / 2 spacing: 5 layoutDirection: Qt.RightToLeft