From 0db026f775c08851de38d25373f9595b4459599c Mon Sep 17 00:00:00 2001 From: purian23 Date: Thu, 24 Jul 2025 16:05:30 -0400 Subject: [PATCH] Recalculate compact modes --- Modules/TopBar/FocusedApp.qml | 6 +++--- Modules/TopBar/TopBar.qml | 22 +++++++++++++--------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/Modules/TopBar/FocusedApp.qml b/Modules/TopBar/FocusedApp.qml index 770d2773..b162258b 100644 --- a/Modules/TopBar/FocusedApp.qml +++ b/Modules/TopBar/FocusedApp.qml @@ -9,7 +9,7 @@ Rectangle { property int availableWidth: 400 readonly property int baseWidth: contentRow.implicitWidth + Theme.spacingS * 2 readonly property int maxNormalWidth: 456 - readonly property int maxCompactWidth: 200 + readonly property int maxCompactWidth: 288 width: compactMode ? Math.min(baseWidth, maxCompactWidth) : Math.min(baseWidth, maxNormalWidth) height: 30 @@ -55,8 +55,8 @@ Rectangle { anchors.verticalCenter: parent.verticalCenter elide: Text.ElideRight maximumLineCount: 1 - width: Math.min(implicitWidth, compactMode ? 60 : 250) - visible: !compactMode || text.length < 15 + width: Math.min(implicitWidth, compactMode ? 180 : 250) + visible: text.length > 0 } } diff --git a/Modules/TopBar/TopBar.qml b/Modules/TopBar/TopBar.qml index e77a38a1..e2751915 100644 --- a/Modules/TopBar/TopBar.qml +++ b/Modules/TopBar/TopBar.qml @@ -113,23 +113,27 @@ PanelWindow { id: topBarContent readonly property int availableWidth: width - readonly property int leftSectionWidth: leftSection.width + // Use estimated fixed widths to break circular dependencies + readonly property int launcherButtonWidth: 40 + readonly property int workspaceSwitcherWidth: 120 // Approximate + readonly property int focusedAppMaxWidth: focusedApp.visible ? (topBarContent.spacingTight ? 288 : 456) : 0 + readonly property int estimatedLeftSectionWidth: launcherButtonWidth + workspaceSwitcherWidth + focusedAppMaxWidth + (Theme.spacingXS * 2) readonly property int rightSectionWidth: rightSection.width readonly property int clockWidth: clock.width - readonly property int mediaWidth: media.visible ? media.width : 0 + readonly property int mediaMaxWidth: media.visible ? 280 : 0 // Normal max width readonly property int weatherWidth: weather.visible ? weather.width : 0 - readonly property bool validLayout: availableWidth > 100 && leftSectionWidth > 0 && rightSectionWidth > 0 + readonly property bool validLayout: availableWidth > 100 && estimatedLeftSectionWidth > 0 && rightSectionWidth > 0 readonly property int clockLeftEdge: validLayout ? (availableWidth - clockWidth) / 2 : 0 readonly property int clockRightEdge: clockLeftEdge + clockWidth - readonly property int leftSectionRightEdge: leftSectionWidth - readonly property int mediaLeftEdge: clockLeftEdge - mediaWidth - Theme.spacingS + readonly property int leftSectionRightEdge: estimatedLeftSectionWidth + readonly property int mediaLeftEdge: clockLeftEdge - mediaMaxWidth - Theme.spacingS readonly property int rightSectionLeftEdge: availableWidth - rightSectionWidth readonly property int leftToClockGap: validLayout ? Math.max(0, clockLeftEdge - leftSectionRightEdge) : 1000 - readonly property int leftToMediaGap: (mediaWidth > 0 && validLayout) ? Math.max(0, mediaLeftEdge - leftSectionRightEdge) : leftToClockGap - readonly property int mediaToClockGap: mediaWidth > 0 ? Theme.spacingS : 0 + readonly property int leftToMediaGap: (mediaMaxWidth > 0 && validLayout) ? Math.max(0, mediaLeftEdge - leftSectionRightEdge) : leftToClockGap + readonly property int mediaToClockGap: mediaMaxWidth > 0 ? Theme.spacingS : 0 readonly property int clockToRightGap: validLayout ? Math.max(0, rightSectionLeftEdge - clockRightEdge) : 1000 - readonly property bool spacingTight: validLayout && (leftToMediaGap < 100 || clockToRightGap < 100) - readonly property bool overlapping: validLayout && (leftToMediaGap < 50 || clockToRightGap < 50) + readonly property bool spacingTight: validLayout && (leftToMediaGap < 150 || clockToRightGap < 100) + readonly property bool overlapping: validLayout && (leftToMediaGap < 100 || clockToRightGap < 50) anchors.fill: parent anchors.leftMargin: Theme.spacingM