From ee50d84a53b548138b5e4cde163c31f845408a1a Mon Sep 17 00:00:00 2001 From: Ly-sec Date: Sat, 13 Sep 2025 15:51:21 +0200 Subject: [PATCH] Fix spacing for vertical bar --- Modules/Bar/Bar.qml | 14 ++++---------- Modules/Bar/Widgets/ActiveWindow.qml | 13 ++++++------- Modules/Bar/Widgets/MediaMini.qml | 10 +++++----- Modules/Bar/Widgets/SystemMonitor.qml | 21 ++++++++++----------- Modules/Bar/Widgets/Workspace.qml | 6 +++--- 5 files changed, 28 insertions(+), 36 deletions(-) diff --git a/Modules/Bar/Bar.qml b/Modules/Bar/Bar.qml index f9673d0..5972252 100644 --- a/Modules/Bar/Bar.qml +++ b/Modules/Bar/Bar.qml @@ -171,14 +171,13 @@ Variants { Component { id: horizontalBarComponent - Row { + Item { anchors.fill: parent // Left Section - Row { + RowLayout { id: leftSection objectName: "leftSection" - height: parent.height anchors.left: parent.left anchors.leftMargin: Style.marginS * root.scaling anchors.verticalCenter: parent.verticalCenter @@ -197,16 +196,14 @@ Variants { "sectionWidgetsCount": Settings.data.bar.widgets.left.length, "barPosition": BarService.position } - anchors.verticalCenter: parent.verticalCenter } } } // Center Section - Row { + RowLayout { id: centerSection objectName: "centerSection" - height: parent.height anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter spacing: Style.marginS * root.scaling @@ -224,16 +221,14 @@ Variants { "sectionWidgetsCount": Settings.data.bar.widgets.center.length, "barPosition": BarService.position } - anchors.verticalCenter: parent.verticalCenter } } } // Right Section - Row { + RowLayout { id: rightSection objectName: "rightSection" - height: parent.height anchors.right: parent.right anchors.rightMargin: Style.marginS * root.scaling anchors.verticalCenter: parent.verticalCenter @@ -252,7 +247,6 @@ Variants { "sectionWidgetsCount": Settings.data.bar.widgets.right.length, "barPosition": BarService.position } - anchors.verticalCenter: parent.verticalCenter } } } diff --git a/Modules/Bar/Widgets/ActiveWindow.qml b/Modules/Bar/Widgets/ActiveWindow.qml index 2447fef..cdb8c44 100644 --- a/Modules/Bar/Widgets/ActiveWindow.qml +++ b/Modules/Bar/Widgets/ActiveWindow.qml @@ -19,17 +19,17 @@ Item { property int sectionWidgetIndex: -1 property int sectionWidgetsCount: 0 property string barPosition: "top" - + // Listen to BarService position changes Connections { target: BarService function onBarPositionChanged(newPosition) { barPosition = newPosition // Force re-evaluation of implicit sizing - implicitWidth = Qt.binding(function() { - return (barPosition === "left" || barPosition === "right") ? Math.round(Style.baseWidgetSize * 0.8 * scaling) : calculatedHorizontalWidth() + implicitWidth = Qt.binding(function () { + return (barPosition === "left" || barPosition === "right") ? Math.round(Style.baseWidgetSize * 0.8 * scaling) : (horizontalLayout.implicitWidth + Style.marginM * 2 * scaling) }) - implicitHeight = Qt.binding(function() { + implicitHeight = Qt.binding(function () { return (barPosition === "left" || barPosition === "right") ? calculatedVerticalHeight() : Math.round(Style.barHeight * scaling) }) } @@ -53,7 +53,7 @@ Item { readonly property real maxWidth: minWidth * 2 implicitHeight: (barPosition === "left" || barPosition === "right") ? calculatedVerticalHeight() : Math.round(Style.barHeight * scaling) - implicitWidth: (barPosition === "left" || barPosition === "right") ? Math.round(Style.baseWidgetSize * 0.8 * scaling) : calculatedHorizontalWidth() + implicitWidth: (barPosition === "left" || barPosition === "right") ? Math.round(Style.baseWidgetSize * 0.8 * scaling) : (horizontalLayout.implicitWidth + Style.marginM * 2 * scaling) function getTitle() { try { @@ -97,8 +97,7 @@ Item { total += titleWidth } - // Row layout handles spacing between widgets - + // Row layout handles spacing between widgets return Math.max(total, Style.capsuleHeight * scaling) // Minimum width } diff --git a/Modules/Bar/Widgets/MediaMini.qml b/Modules/Bar/Widgets/MediaMini.qml index 458095c..9f97017 100644 --- a/Modules/Bar/Widgets/MediaMini.qml +++ b/Modules/Bar/Widgets/MediaMini.qml @@ -19,17 +19,17 @@ Item { property int sectionWidgetIndex: -1 property int sectionWidgetsCount: 0 property string barPosition: "top" - + // Listen to BarService position changes Connections { target: BarService function onBarPositionChanged(newPosition) { barPosition = newPosition // Force re-evaluation of implicit sizing - implicitWidth = Qt.binding(function() { - return (barPosition === "left" || barPosition === "right") ? Math.round(Style.baseWidgetSize * 0.8 * scaling) : calculatedHorizontalWidth() + implicitWidth = Qt.binding(function () { + return (barPosition === "left" || barPosition === "right") ? Math.round(Style.baseWidgetSize * 0.8 * scaling) : (rowLayout.implicitWidth + Style.marginM * 2 * scaling) }) - implicitHeight = Qt.binding(function() { + implicitHeight = Qt.binding(function () { return (barPosition === "left" || barPosition === "right") ? calculatedVerticalHeight() : Math.round(Style.barHeight * scaling) }) } @@ -75,7 +75,7 @@ Item { } implicitHeight: (barPosition === "left" || barPosition === "right") ? calculatedVerticalHeight() : Math.round(Style.barHeight * scaling) - implicitWidth: (barPosition === "left" || barPosition === "right") ? Math.round(Style.baseWidgetSize * 0.8 * scaling) : calculatedHorizontalWidth() + implicitWidth: (barPosition === "left" || barPosition === "right") ? Math.round(Style.baseWidgetSize * 0.8 * scaling) : (rowLayout.implicitWidth + Style.marginM * 2 * scaling) visible: MediaService.currentPlayer !== null && MediaService.canPlay diff --git a/Modules/Bar/Widgets/SystemMonitor.qml b/Modules/Bar/Widgets/SystemMonitor.qml index 41d1a06..f9d8956 100644 --- a/Modules/Bar/Widgets/SystemMonitor.qml +++ b/Modules/Bar/Widgets/SystemMonitor.qml @@ -17,17 +17,17 @@ Item { property int sectionWidgetIndex: -1 property int sectionWidgetsCount: 0 property string barPosition: "top" - + // Listen to BarService position changes Connections { target: BarService function onBarPositionChanged(newPosition) { barPosition = newPosition // Force re-evaluation of implicit sizing - implicitWidth = Qt.binding(function() { - return (barPosition === "left" || barPosition === "right") ? Math.round(Style.capsuleHeight * scaling) : calculatedHorizontalWidth() + implicitWidth = Qt.binding(function () { + return (barPosition === "left" || barPosition === "right") ? Math.round(Style.capsuleHeight * scaling) : (horizontalLayout.implicitWidth + Style.marginL * 2 * scaling) }) - implicitHeight = Qt.binding(function() { + implicitHeight = Qt.binding(function () { return (barPosition === "left" || barPosition === "right") ? calculatedVerticalHeight() : Math.round(Style.barHeight * scaling) }) } @@ -52,7 +52,7 @@ Item { readonly property bool showDiskUsage: (widgetSettings.showDiskUsage !== undefined) ? widgetSettings.showDiskUsage : widgetMetadata.showDiskUsage implicitHeight: (barPosition === "left" || barPosition === "right") ? calculatedVerticalHeight() : Math.round(Style.barHeight * scaling) - implicitWidth: (barPosition === "left" || barPosition === "right") ? Math.round(Style.capsuleHeight * scaling) : calculatedHorizontalWidth() + implicitWidth: (barPosition === "left" || barPosition === "right") ? Math.round(Style.capsuleHeight * scaling) : (horizontalLayout.implicitWidth + Style.marginL * 2 * scaling) function calculatedVerticalHeight() { let total = 0 @@ -70,14 +70,14 @@ Item { visibleCount++ total = visibleCount * Math.round(Style.capsuleHeight * scaling) - total += Math.max(visibleCount - 1, 0) * Style.marginS * scaling + total += Math.max(visibleCount - 1, 0) * Style.marginXS * scaling total += Style.marginM * scaling * 2 // padding return total } function calculatedHorizontalWidth() { - let total = Style.marginM * scaling * 2 // base padding + let total = Style.marginL * scaling * 2.5 // base padding if (showCpuUsage) { // Icon + "99%" text @@ -136,8 +136,7 @@ Item { total += (visibleCount - 1) * Style.marginXS * scaling } - // Row layout handles spacing between widgets - + // Row layout handles spacing between widgets return Math.max(total, Style.capsuleHeight * scaling) } @@ -145,7 +144,7 @@ Item { id: backgroundContainer anchors.left: parent.left anchors.verticalCenter: parent.verticalCenter - width: (barPosition === "left" || barPosition === "right") ? Math.round(Style.capsuleHeight * scaling) : calculatedHorizontalWidth() + width: (barPosition === "left" || barPosition === "right") ? Math.round(Style.capsuleHeight * scaling) : (horizontalLayout.implicitWidth + Style.marginL * 2 * scaling) height: (barPosition === "left" || barPosition === "right") ? parent.height : Math.round(Style.capsuleHeight * scaling) radius: Math.round(Style.radiusM * scaling) color: Color.mSurfaceVariant @@ -345,7 +344,7 @@ Item { anchors.centerIn: parent width: Math.round(32 * scaling) height: parent.height - Style.marginM * scaling * 2 - spacing: Style.marginS * scaling + spacing: Style.marginXS * scaling visible: barPosition === "left" || barPosition === "right" // CPU Usage Component diff --git a/Modules/Bar/Widgets/Workspace.qml b/Modules/Bar/Widgets/Workspace.qml index 150981c..dd50db2 100644 --- a/Modules/Bar/Widgets/Workspace.qml +++ b/Modules/Bar/Widgets/Workspace.qml @@ -20,17 +20,17 @@ Item { property int sectionWidgetIndex: -1 property int sectionWidgetsCount: 0 property string barPosition: "top" - + // Listen to BarService position changes Connections { target: BarService function onBarPositionChanged(newPosition) { barPosition = newPosition // Force re-evaluation of implicit sizing - implicitWidth = Qt.binding(function() { + implicitWidth = Qt.binding(function () { return (barPosition === "left" || barPosition === "right") ? Math.round(Style.barHeight * scaling) : calculatedHorizontalWidth() }) - implicitHeight = Qt.binding(function() { + implicitHeight = Qt.binding(function () { return (barPosition === "left" || barPosition === "right") ? calculatedVerticalHeight() : Math.round(Style.barHeight * scaling) }) }