From 2be46ff65ab50026e831c42b25c1a4f86eb413c4 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Fri, 15 Aug 2025 21:49:09 +1000 Subject: internal: static bar width --- modules/bar/Bar.qml | 4 +--- modules/bar/BarWrapper.qml | 13 ++++++++----- modules/bar/components/StatusIcons.qml | 2 +- modules/bar/components/Tray.qml | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) (limited to 'modules/bar') diff --git a/modules/bar/Bar.qml b/modules/bar/Bar.qml index 71a5b79..ec2cae9 100644 --- a/modules/bar/Bar.qml +++ b/modules/bar/Bar.qml @@ -15,7 +15,6 @@ ColumnLayout { required property ShellScreen screen required property PersistentProperties visibilities required property BarPopouts.Wrapper popouts - readonly property int padding: Math.max(Appearance.padding.smaller, Config.border.thickness) readonly property int vPadding: Appearance.padding.large function checkPopout(y: real): void { @@ -171,8 +170,6 @@ ColumnLayout { } Layout.alignment: Qt.AlignHCenter - Layout.leftMargin: root.padding - Layout.rightMargin: root.padding // Cursed ahh thing to add padding to first and last enabled components Layout.topMargin: findFirstEnabled() === this ? root.vPadding : 0 @@ -180,5 +177,6 @@ ColumnLayout { visible: enabled active: enabled + asynchronous: true } } diff --git a/modules/bar/BarWrapper.qml b/modules/bar/BarWrapper.qml index cd414bb..83ff1c3 100644 --- a/modules/bar/BarWrapper.qml +++ b/modules/bar/BarWrapper.qml @@ -12,7 +12,9 @@ Item { required property PersistentProperties visibilities required property BarPopouts.Wrapper popouts - readonly property int exclusiveZone: Config.bar.persistent || visibilities.bar ? content.implicitWidth : Config.border.thickness + readonly property int padding: Math.max(Appearance.padding.smaller, Config.border.thickness) + readonly property int contentWidth: Config.bar.sizes.innerWidth + padding * 2 + readonly property int exclusiveZone: Config.bar.persistent || visibilities.bar ? contentWidth : Config.border.thickness readonly property bool shouldBeVisible: Config.bar.persistent || visibilities.bar || isHovered property bool isHovered @@ -26,14 +28,13 @@ Item { visible: width > Config.border.thickness implicitWidth: Config.border.thickness - implicitHeight: content.implicitHeight states: State { name: "visible" when: root.shouldBeVisible PropertyChanges { - root.implicitWidth: content.implicitWidth + root.implicitWidth: root.contentWidth } } @@ -67,13 +68,15 @@ Item { Loader { id: content - Component.onCompleted: active = Qt.binding(() => root.shouldBeVisible || root.visible) - anchors.top: parent.top anchors.bottom: parent.bottom anchors.right: parent.right + active: root.shouldBeVisible || root.visible + asynchronous: true + sourceComponent: Bar { + width: root.contentWidth screen: root.screen visibilities: root.visibilities popouts: root.popouts diff --git a/modules/bar/components/StatusIcons.qml b/modules/bar/components/StatusIcons.qml index f7d9828..7db79c7 100644 --- a/modules/bar/components/StatusIcons.qml +++ b/modules/bar/components/StatusIcons.qml @@ -20,7 +20,7 @@ StyledRect { radius: Appearance.rounding.full clip: true - implicitWidth: iconColumn.implicitWidth + Appearance.padding.normal * 2 + implicitWidth: Config.bar.sizes.innerWidth implicitHeight: iconColumn.implicitHeight + Appearance.padding.normal * 2 ColumnLayout { diff --git a/modules/bar/components/Tray.qml b/modules/bar/components/Tray.qml index c921409..df664d9 100644 --- a/modules/bar/components/Tray.qml +++ b/modules/bar/components/Tray.qml @@ -12,7 +12,7 @@ StyledRect { clip: true visible: width > 0 && height > 0 // To avoid warnings about being visible with no size - implicitWidth: layout.implicitWidth + Math.floor(Appearance.padding.normal * 1.8) + implicitWidth: Config.bar.sizes.innerWidth implicitHeight: layout.implicitHeight + (Config.bar.tray.background ? Appearance.padding.normal : Appearance.padding.small) * 2 color: Qt.alpha(Colours.tPalette.m3surfaceContainer, Config.bar.tray.background ? Colours.tPalette.m3surfaceContainer.a : 0) -- cgit v1.2.3-freya