From 4718922c55754faabae13e7355782f71b1624c1b Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Fri, 6 Feb 2026 22:38:45 +0100 Subject: [PATCH] hefty: bar: proper vertical layouting --- .../ii/modules/common/config/HeftyConfig.qml | 6 ++- .../modules/common/widgets/AxisRectangle.qml | 15 ++++++ .../hefty/topLayer/bar/HBarContent.qml | 47 ++++++++++++++++--- .../hefty/topLayer/bar/HBarGroupContainer.qml | 20 ++++---- 4 files changed, 69 insertions(+), 19 deletions(-) create mode 100644 dots/.config/quickshell/ii/modules/common/widgets/AxisRectangle.qml diff --git a/dots/.config/quickshell/ii/modules/common/config/HeftyConfig.qml b/dots/.config/quickshell/ii/modules/common/config/HeftyConfig.qml index 7d765c1b2..509d4dccf 100644 --- a/dots/.config/quickshell/ii/modules/common/config/HeftyConfig.qml +++ b/dots/.config/quickshell/ii/modules/common/config/HeftyConfig.qml @@ -4,8 +4,10 @@ import Quickshell.Io JsonObject { property JsonObject bar: JsonObject { - property list leftWidgets: [] - property list centerWidgets: [["Workspaces"]] + property list leftWidgets: [["HWindowInfo"]] + property list centerLeftWidgets: [["HTime"]] + property list centerWidgets: [["HWorkspaces"]] + property list centerRightWidgets: [["HBattery"]] property list rightWidgets: [] property bool m3ExpressiveGrouping: true } diff --git a/dots/.config/quickshell/ii/modules/common/widgets/AxisRectangle.qml b/dots/.config/quickshell/ii/modules/common/widgets/AxisRectangle.qml new file mode 100644 index 000000000..d54594ecd --- /dev/null +++ b/dots/.config/quickshell/ii/modules/common/widgets/AxisRectangle.qml @@ -0,0 +1,15 @@ +pragma ComponentBehavior: Bound +import QtQuick + +StyledRectangle { + id: root + + property bool vertical: false + property real startRadius + property real endRadius + + topLeftRadius: startRadius + topRightRadius: vertical ? startRadius : endRadius + bottomLeftRadius: vertical ? endRadius : startRadius + bottomRightRadius: endRadius +} diff --git a/dots/.config/quickshell/ii/modules/hefty/topLayer/bar/HBarContent.qml b/dots/.config/quickshell/ii/modules/hefty/topLayer/bar/HBarContent.qml index d090a9221..a26e5b232 100644 --- a/dots/.config/quickshell/ii/modules/hefty/topLayer/bar/HBarContent.qml +++ b/dots/.config/quickshell/ii/modules/hefty/topLayer/bar/HBarContent.qml @@ -1,3 +1,4 @@ +pragma ComponentBehavior: Bound import QtQuick import QtQuick.Layouts import qs.modules.common as C @@ -5,36 +6,70 @@ import qs.modules.common as C Item { id: root + property bool vertical: C.Config.options.bar.vertical + property real spacing: 4 + Side { id: leftSide anchors.left: parent.left - width: (parent.width - centerSide.width) / 2 + anchors.top: parent.top + HBarUserFallbackComponentRepeater { componentNames: C.Config.options.hefty.bar.leftWidgets } } + Side { + id: centerLeftSide + anchors.right: !root.vertical ? centerSide.left : parent.right + anchors.bottom: root.vertical ? parent.bottom : undefined + HBarUserFallbackComponentRepeater { + componentNames: C.Config.options.hefty.bar.centerLeftWidgets + } + } + Side { id: centerSide - anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: root.vertical ? parent.verticalCenter : undefined + anchors.horizontalCenter: !root.vertical ? parent.horizontalCenter : undefined HBarUserFallbackComponentRepeater { componentNames: C.Config.options.hefty.bar.centerWidgets } } + Side { + id: centerRightSide + anchors.left: !root.vertical ? centerSide.right : parent.left + anchors.top: root.vertical ? parent.top : undefined + HBarUserFallbackComponentRepeater { + componentNames: C.Config.options.hefty.bar.centerRightWidgets + } + } + Side { id: rightSide anchors.right: parent.right - width: (parent.width - centerSide.width) / 2 + anchors.bottom: parent.bottom HBarUserFallbackComponentRepeater { componentNames: C.Config.options.hefty.bar.rightWidgets } } - component Side: RowLayout { + component Side: GridLayout { anchors { - top: parent.top - bottom: parent.bottom + top: !root.vertical ? parent.top : undefined + bottom: !root.vertical ? parent.bottom : undefined + topMargin: root.spacing * root.vertical + bottomMargin: root.spacing * root.vertical + left: root.vertical ? parent.left : undefined + right: root.vertical ? parent.right : undefined + leftMargin: root.spacing * !root.vertical + rightMargin: root.spacing * !root.vertical } + + columns: C.Config.options.bar.vertical ? 1 : -1 + property real spacing: root.spacing + columnSpacing: spacing + rowSpacing: spacing } } diff --git a/dots/.config/quickshell/ii/modules/hefty/topLayer/bar/HBarGroupContainer.qml b/dots/.config/quickshell/ii/modules/hefty/topLayer/bar/HBarGroupContainer.qml index 54bb0ef43..fc8f2b863 100644 --- a/dots/.config/quickshell/ii/modules/hefty/topLayer/bar/HBarGroupContainer.qml +++ b/dots/.config/quickshell/ii/modules/hefty/topLayer/bar/HBarGroupContainer.qml @@ -17,17 +17,18 @@ Item { readonly property bool vertical: C.Config.options.bar.vertical readonly property bool m3eRadius: C.Config.options.hefty.bar.m3ExpressiveGrouping readonly property real barUndirectionalWidth: C.Config.options.bar.vertical ? C.Appearance.sizes.baseVerticalBarWidth : C.Appearance.sizes.baseBarHeight + readonly property real backgroundUndirectionalWidth: barUndirectionalWidth - margins * 2 - implicitWidth: vertical ? barUndirectionalWidth : layout.implicitWidth + (padding + margins) * 2 - implicitHeight: vertical ? layout.implicitHeight + (padding + margins) * 2 : barUndirectionalWidth + implicitWidth: vertical ? barUndirectionalWidth : layout.implicitWidth + padding * 2 + implicitHeight: vertical ? layout.implicitHeight + padding * 2 : barUndirectionalWidth - W.StyledRectangle { + W.AxisRectangle { id: bg anchors.centerIn: parent contentLayer: W.StyledRectangle.ContentLayer.Pane - width: (root.vertical ? root.barUndirectionalWidth : root.width) - root.margins * 2 - height: (root.vertical ? root.height : root.barUndirectionalWidth) - root.margins * 2 + width: root.vertical ? root.backgroundUndirectionalWidth : root.width + height: root.vertical ? root.height : root.backgroundUndirectionalWidth property real fullRadius: Math.min(width, height) / 2 function getRadius(atSide) { @@ -38,12 +39,9 @@ Item { return 12; } } - property real startRadius: getRadius(root.startSide) - property real endRadius: getRadius(root.endSide) - topLeftRadius: startRadius - topRightRadius: root.vertical ? startRadius : endRadius - bottomLeftRadius: root.vertical ? endRadius : startRadius - bottomRightRadius: endRadius + vertical: root.vertical + startRadius: getRadius(root.startSide) + endRadius: getRadius(root.endSide) } GridLayout {