bar: cleaner width

This commit is contained in:
end-4
2025-04-27 20:35:01 +02:00
parent f2a9641a95
commit 7f9dc76698
2 changed files with 8 additions and 5 deletions
@@ -9,7 +9,6 @@ Item {
required property var bar required property var bar
readonly property HyprlandMonitor monitor: Hyprland.monitorFor(bar.screen) readonly property HyprlandMonitor monitor: Hyprland.monitorFor(bar.screen)
readonly property Toplevel activeWindow: ToplevelManager.activeToplevel readonly property Toplevel activeWindow: ToplevelManager.activeToplevel
property int preferredWidth: Appearance.sizes.barPreferredSideSectionWidth
height: parent.height height: parent.height
width: colLayout.width width: colLayout.width
@@ -19,21 +18,23 @@ Item {
ColumnLayout { ColumnLayout {
id: colLayout id: colLayout
anchors.centerIn: parent anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.right: parent.right
spacing: -4 spacing: -4
StyledText { StyledText {
Layout.fillWidth: true
font.pixelSize: Appearance.font.pixelSize.smaller font.pixelSize: Appearance.font.pixelSize.smaller
color: Appearance.colors.colSubtext color: Appearance.colors.colSubtext
Layout.preferredWidth: preferredWidth
elide: Text.ElideRight elide: Text.ElideRight
text: activeWindow?.activated ? activeWindow?.appId : qsTr("Desktop") text: activeWindow?.activated ? activeWindow?.appId : qsTr("Desktop")
} }
StyledText { StyledText {
Layout.fillWidth: true
font.pixelSize: Appearance.font.pixelSize.small font.pixelSize: Appearance.font.pixelSize.small
color: Appearance.colors.colOnLayer0 color: Appearance.colors.colOnLayer0
Layout.preferredWidth: preferredWidth
elide: Text.ElideRight elide: Text.ElideRight
text: activeWindow?.activated ? activeWindow?.title : `${qsTr("Workspace")} ${monitor.activeWorkspace?.id}` text: activeWindow?.activated ? activeWindow?.title : `${qsTr("Workspace")} ${monitor.activeWorkspace?.id}`
} }
+3 -1
View File
@@ -70,8 +70,10 @@ Scope {
id: leftSection id: leftSection
anchors.left: parent.left anchors.left: parent.left
implicitHeight: barHeight implicitHeight: barHeight
width: (barRoot.width - middleSection.width) / 2
ActiveWindow { ActiveWindow {
Layout.fillWidth: true
bar: barRoot bar: barRoot
} }
} }
@@ -134,7 +136,7 @@ Scope {
id: rightSection id: rightSection
anchors.right: parent.right anchors.right: parent.right
implicitHeight: barHeight implicitHeight: barHeight
width: Appearance.sizes.barPreferredSideSectionWidth width: (barRoot.width - middleSection.width) / 2
spacing: 5 spacing: 5
layoutDirection: Qt.RightToLeft layoutDirection: Qt.RightToLeft