From ef8811724f38074a04f13bce5787770b485d002f Mon Sep 17 00:00:00 2001 From: zach Date: Fri, 14 Aug 2026 18:03:56 +0200 Subject: [PATCH] better height/width for bar --- Drawers/Panels.qml | 1 - Modules/Bar/Bar.qml | 22 ++-------------------- Modules/Bar/BarLoader.qml | 4 ++-- Modules/Clock.qml | 3 +-- Modules/Dashboard/Wrapper.qml | 6 ++++-- Modules/HyprsunsetWidget.qml | 5 ++--- Modules/MediaWidget.qml | 5 ++--- Modules/NotifBell.qml | 5 ++--- Modules/Resources.qml | 3 +-- Modules/SysTray/StatusIcons.qml | 3 +-- Modules/SysTray/TrayIcons.qml | 3 +-- Modules/Updates/UpdatesWidget.qml | 3 +-- Modules/Workspaces.qml | 6 +++--- 13 files changed, 22 insertions(+), 47 deletions(-) diff --git a/Drawers/Panels.qml b/Drawers/Panels.qml index a3b1bd6..6dfd863 100644 --- a/Drawers/Panels.qml +++ b/Drawers/Panels.qml @@ -169,7 +169,6 @@ Item { Dashboard.Wrapper { id: dashboard - anchors.right: parent.right horizontal: root.geometry.horizontal offsetScale: dashboardWrapper.offsetScale visibilities: root.visibilities diff --git a/Modules/Bar/Bar.qml b/Modules/Bar/Bar.qml index 74a79ad..be47506 100644 --- a/Modules/Bar/Bar.qml +++ b/Modules/Bar/Bar.qml @@ -92,8 +92,6 @@ GridLayout { roleValue: "hyprsunset" delegate: EntryWrapper { - Layout.fillWidth: !root.horizontal - HyprsunsetWidget { horizontal: root.horizontal visible: !root.fullscreen @@ -126,8 +124,6 @@ GridLayout { roleValue: "tray" delegate: EntryWrapper { - Layout.fillWidth: !root.horizontal - TrayIcons { horizontal: root.horizontal loader: root @@ -141,8 +137,6 @@ GridLayout { roleValue: "statusIcons" delegate: EntryWrapper { - Layout.fillWidth: !root.horizontal - StatusIcons { horizontal: root.horizontal } @@ -153,8 +147,6 @@ GridLayout { roleValue: "resources" delegate: EntryWrapper { - Layout.fillWidth: !root.horizontal - Resources { horizontal: root.horizontal visibilities: root.visibilities @@ -167,8 +159,6 @@ GridLayout { roleValue: "updates" delegate: EntryWrapper { - Layout.fillWidth: !root.horizontal - UpdatesWidget { horizontal: root.horizontal visible: !root.fullscreen @@ -180,8 +170,6 @@ GridLayout { roleValue: "notifBell" delegate: EntryWrapper { - Layout.fillWidth: !root.horizontal - NotifBell { horizontal: root.horizontal popouts: root.popouts @@ -195,8 +183,6 @@ GridLayout { roleValue: "clock" delegate: EntryWrapper { - Layout.fillWidth: !root.horizontal - Clock { horizontal: root.horizontal loader: root @@ -211,8 +197,6 @@ GridLayout { roleValue: "activeWindow" delegate: EntryWrapper { - Layout.fillWidth: !root.horizontal - WindowTitle { bar: root horizontal: root.horizontal @@ -234,8 +218,6 @@ GridLayout { roleValue: "media" delegate: EntryWrapper { - Layout.fillWidth: !root.horizontal - MediaWidget { horizontal: root.horizontal visible: !root.fullscreen @@ -253,8 +235,8 @@ GridLayout { Layout.alignment: root.horizontal ? Qt.AlignVCenter : Qt.AlignHCenter Layout.bottomMargin: !root.horizontal && index === repeater.count - 1 ? root.vPadding : 0 - Layout.leftMargin: root.horizontal && index === 0 ? root.vPadding : (entryId === "statusIcons" && root.horizontal) ? -root.rowSpacing + Appearance.spacing.extraSmall : root.horizontal ? 0 : Appearance.padding.smaller - Layout.rightMargin: root.horizontal && index === repeater.count - 1 ? root.vPadding : root.horizontal ? 0 : Appearance.padding.smaller + Layout.leftMargin: root.horizontal && index === 0 ? root.vPadding : (entryId === "statusIcons" && root.horizontal) ? -root.rowSpacing + Appearance.spacing.extraSmall : 0 + Layout.rightMargin: root.horizontal && index === repeater.count - 1 ? root.vPadding : 0 Layout.topMargin: !root.horizontal && index === 0 ? root.vPadding : (entryId === "statusIcons" && !root.horizontal) ? -root.columnSpacing + Appearance.spacing.extraSmall : 0 children: item implicitHeight: item?.implicitHeight ?? 0 diff --git a/Modules/Bar/BarLoader.qml b/Modules/Bar/BarLoader.qml index fafd193..55e286e 100644 --- a/Modules/Bar/BarLoader.qml +++ b/Modules/Bar/BarLoader.qml @@ -10,13 +10,13 @@ Item { id: root readonly property int clampedExtent: Math.max(Config.bar.border, extent) - readonly property int contentThickness: Math.max(Config.bar.height, (horizontal ? 24 : 30)) + padding * 2 + readonly property int contentThickness: Math.max(Config.bar.height, 30) + padding * 2 readonly property int exclusiveZone: Config.bar.autoHide ? Config.bar.border : contentThickness property real extent: fullscreen ? 0 : Config.bar.border required property bool fullscreen readonly property bool horizontal: position !== "left" property bool isHovered - readonly property int padding: horizontal ? Math.max(Appearance.padding.smaller, Config.bar.border) : Math.max(Appearance.padding.larger, Config.bar.border) + readonly property int padding: Appearance.padding.smaller required property Wrapper popouts required property ClipWrapper popoutsWrapper required property string position diff --git a/Modules/Clock.qml b/Modules/Clock.qml index 15f95de..0ec2816 100644 --- a/Modules/Clock.qml +++ b/Modules/Clock.qml @@ -12,11 +12,10 @@ CustomRect { required property bool horizontal required property GridLayout loader required property Wrapper popouts - readonly property real shortSize: Config.bar.height + Appearance.padding.smallest * 2 + readonly property real shortSize: Config.bar.height readonly property real size: timeText.contentWidth + (horizontal ? Appearance.padding.normal : Appearance.padding.larger) * 2 required property PersistentProperties visibilities - anchors.fill: parent color: visibilities.dashboard ? DynamicColors.palette.m3primary : DynamicColors.tPalette.m3surfaceContainer implicitHeight: horizontal ? shortSize : size implicitWidth: horizontal ? size : shortSize diff --git a/Modules/Dashboard/Wrapper.qml b/Modules/Dashboard/Wrapper.qml index 747d0e4..946fc6e 100644 --- a/Modules/Dashboard/Wrapper.qml +++ b/Modules/Dashboard/Wrapper.qml @@ -33,8 +33,10 @@ Item { id: content active: root.shouldBeActive || root.visible - anchors.bottom: parent.bottom - anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: root.horizontal ? parent.bottom : undefined + anchors.horizontalCenter: root.horizontal ? parent.horizontalCenter : undefined + anchors.right: root.horizontal ? undefined : parent.right + anchors.verticalCenter: root.horizontal ? undefined : parent.verticalCenter sourceComponent: Content { dashState: root.dashState diff --git a/Modules/HyprsunsetWidget.qml b/Modules/HyprsunsetWidget.qml index c5bd375..5dd364a 100644 --- a/Modules/HyprsunsetWidget.qml +++ b/Modules/HyprsunsetWidget.qml @@ -9,10 +9,9 @@ CustomRect { required property bool horizontal property bool tempEnabled: Hyprsunset.enabled - anchors.fill: parent color: root.tempEnabled ? DynamicColors.palette.m3primary : DynamicColors.tPalette.m3surfaceContainer - implicitHeight: horizontal ? Config.bar.height + Appearance.padding.smallest * 2 : width - implicitWidth: horizontal ? height : Config.bar.height + Appearance.padding.smallest * 2 + implicitHeight: horizontal ? Config.bar.height : width + implicitWidth: horizontal ? height : Config.bar.height radius: Appearance.rounding.full StateLayer { diff --git a/Modules/MediaWidget.qml b/Modules/MediaWidget.qml index 9208622..ad52b3e 100644 --- a/Modules/MediaWidget.qml +++ b/Modules/MediaWidget.qml @@ -12,10 +12,9 @@ CustomRect { required property bool horizontal readonly property int textWidth: Math.min(metrics.width, 200) - anchors.fill: parent color: DynamicColors.tPalette.m3surfaceContainer - implicitHeight: horizontal ? Config.bar.height + Appearance.padding.smallest * 2 : layout.implicitHeight + Appearance.padding.normal * 2 - implicitWidth: horizontal ? layout.implicitWidth + Appearance.padding.normal * 2 : Config.bar.height + Appearance.padding.smallest + implicitHeight: horizontal ? Config.bar.height : layout.implicitHeight + Appearance.padding.normal * 2 + implicitWidth: horizontal ? layout.implicitWidth + Appearance.padding.normal * 2 : Config.bar.height radius: Appearance.rounding.full Behavior on implicitWidth { diff --git a/Modules/NotifBell.qml b/Modules/NotifBell.qml index dabacab..05cfacc 100644 --- a/Modules/NotifBell.qml +++ b/Modules/NotifBell.qml @@ -11,10 +11,9 @@ CustomRect { required property Wrapper popouts required property PersistentProperties visibilities - anchors.fill: parent color: visibilities.sidebar ? DynamicColors.palette.m3primary : DynamicColors.tPalette.m3surfaceContainer - implicitHeight: horizontal ? Config.bar.height + Appearance.padding.smallest * 2 : width - implicitWidth: horizontal ? height : Config.bar.height + Appearance.padding.smallest * 2 + implicitHeight: horizontal ? Config.bar.height : width + implicitWidth: horizontal ? height : Config.bar.height radius: Appearance.rounding.full MaterialIcon { diff --git a/Modules/Resources.qml b/Modules/Resources.qml index f33c442..706560b 100644 --- a/Modules/Resources.qml +++ b/Modules/Resources.qml @@ -15,10 +15,9 @@ CustomRect { required property bool horizontal required property PersistentProperties visibilities - anchors.fill: parent clip: true color: visibilities.resources ? DynamicColors.palette.m3primary : DynamicColors.tPalette.m3surfaceContainer - implicitHeight: horizontal ? Config.bar.height + Appearance.padding.smallest * 2 : gridLayout.implicitHeight + Appearance.padding.normal * 2 + implicitHeight: horizontal ? Math.max(Config.bar.height, 24) : gridLayout.implicitHeight + Appearance.padding.normal * 2 implicitWidth: horizontal ? gridLayout.implicitWidth + Appearance.padding.larger * 2 : Config.bar.height radius: Appearance.rounding.full diff --git a/Modules/SysTray/StatusIcons.qml b/Modules/SysTray/StatusIcons.qml index 1376fb9..f9e5b3b 100644 --- a/Modules/SysTray/StatusIcons.qml +++ b/Modules/SysTray/StatusIcons.qml @@ -29,7 +29,7 @@ CustomClippingRect { return i; return -1; } - readonly property real shortSize: Config.bar.height + Appearance.padding.smallest * 2 + readonly property real shortSize: Config.bar.height readonly property real size: horizontal ? grid.implicitWidth + Appearance.padding.small * 2 : grid.implicitHeight + Appearance.padding.small * 2 readonly property int spacing: Appearance.spacing.normal / 2 @@ -40,7 +40,6 @@ CustomClippingRect { return false; } - anchors.fill: parent bottomLeftRadius: horizontal ? Appearance.rounding.smallest / 2 : Appearance.rounding.full color: DynamicColors.tPalette.m3surfaceContainer implicitHeight: horizontal ? shortSize : size diff --git a/Modules/SysTray/TrayIcons.qml b/Modules/SysTray/TrayIcons.qml index 74cb001..b2e6f95 100644 --- a/Modules/SysTray/TrayIcons.qml +++ b/Modules/SysTray/TrayIcons.qml @@ -17,10 +17,9 @@ CustomClippingRect { required property GridLayout loader readonly property int padding: Appearance.padding.small required property Wrapper popouts - readonly property real shortSize: Config.bar.height + Appearance.padding.smallest * 2 + readonly property real shortSize: Config.bar.height readonly property real size: horizontal ? sysGrid.implicitWidth + Appearance.padding.small : sysGrid.implicitHeight + Appearance.padding.small - anchors.fill: parent bottomLeftRadius: horizontal ? Appearance.rounding.full : Appearance.rounding.smallest / 2 bottomRightRadius: Appearance.rounding.smallest / 2 color: DynamicColors.tPalette.m3surfaceContainer diff --git a/Modules/Updates/UpdatesWidget.qml b/Modules/Updates/UpdatesWidget.qml index c1cbe32..47480a4 100644 --- a/Modules/Updates/UpdatesWidget.qml +++ b/Modules/Updates/UpdatesWidget.qml @@ -12,9 +12,8 @@ CustomRect { required property bool horizontal property color textColor: DynamicColors.palette.m3onSurface - anchors.fill: parent color: DynamicColors.tPalette.m3surfaceContainer - implicitHeight: horizontal ? Config.bar.height + Appearance.padding.smallest * 2 : content.implicitHeight + Appearance.spacing.small * 2 + implicitHeight: horizontal ? Config.bar.height : content.implicitHeight + Appearance.spacing.small * 2 implicitWidth: horizontal ? content.implicitWidth + Appearance.spacing.small * 2 : Config.bar.height radius: Appearance.rounding.full diff --git a/Modules/Workspaces.qml b/Modules/Workspaces.qml index f9c610d..aa6d71b 100644 --- a/Modules/Workspaces.qml +++ b/Modules/Workspaces.qml @@ -16,7 +16,7 @@ Item { required property bool horizontal readonly property HyprlandMonitor monitor: Hyprland.monitorFor(root.screen) required property ShellScreen screen - readonly property real shortSize: Config.bar.height + Appearance.padding.smaller * 2 + readonly property real shortSize: Math.max(Config.bar.height, 24) readonly property real size: (workspaceButtonWidth * workspacesShown) + activeWorkspaceMargin * 2 property int workspaceButtonWidth: (horizontal ? bgRect.implicitHeight : bgRect.implicitWidth) - root.activeWorkspaceMargin * 2 property int workspaceIndexInGroup: (effectiveActiveWorkspaceId - 1) % root.workspacesShown @@ -50,8 +50,8 @@ Item { anchors.top: root.horizontal ? undefined : parent.top anchors.verticalCenter: root.horizontal ? parent.verticalCenter : undefined color: DynamicColors.tPalette.m3surfaceContainer - implicitHeight: root.horizontal ? root.implicitHeight - ((Appearance.padding.small - 1) * 2) : 0 - implicitWidth: root.horizontal ? 0 : root.implicitWidth - ((Appearance.padding.small - 1) * 2) + implicitHeight: root.horizontal ? root.implicitHeight : 0 + implicitWidth: root.horizontal ? 0 : root.implicitWidth radius: height / 2 // qmllint enable Quick.anchor-combinations