From d05c451294cc6b5e76c9eda381efc73011a68ae7 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Fri, 15 Aug 2025 22:49:43 +0700 Subject: [PATCH] bars: refractor bar groups --- .../quickshell/ii/modules/bar/BarGroup.qml | 35 ++++++++++-------- .../ii/modules/common/Appearance.qml | 2 - .../modules/verticalBar/BatteryIndicator.qml | 2 - .../verticalBar/VerticalBarContent.qml | 9 +++-- .../modules/verticalBar/VerticalBarGroup.qml | 37 ------------------- 5 files changed, 26 insertions(+), 59 deletions(-) delete mode 100644 .config/quickshell/ii/modules/verticalBar/VerticalBarGroup.qml diff --git a/.config/quickshell/ii/modules/bar/BarGroup.qml b/.config/quickshell/ii/modules/bar/BarGroup.qml index e2371d14..35769e40 100644 --- a/.config/quickshell/ii/modules/bar/BarGroup.qml +++ b/.config/quickshell/ii/modules/bar/BarGroup.qml @@ -4,33 +4,38 @@ import QtQuick.Layouts Item { id: root + property bool vertical: false property real padding: 5 - implicitHeight: Appearance.sizes.baseBarHeight - height: Appearance.sizes.barHeight - implicitWidth: rowLayout.implicitWidth + padding * 2 - default property alias items: rowLayout.children + implicitWidth: vertical ? Appearance.sizes.baseVerticalBarWidth : (gridLayout.implicitWidth + padding * 2) + implicitHeight: vertical ? (gridLayout.implicitHeight + padding * 2) : Appearance.sizes.baseBarHeight + default property alias items: gridLayout.children Rectangle { id: background anchors { fill: parent - topMargin: 4 - bottomMargin: 4 + topMargin: root.vertical ? 0 : 4 + bottomMargin: root.vertical ? 0 : 4 + leftMargin: root.vertical ? 4 : 0 + rightMargin: root.vertical ? 4 : 0 } color: Config.options?.bar.borderless ? "transparent" : Appearance.colors.colLayer1 radius: Appearance.rounding.small } - RowLayout { - id: rowLayout + GridLayout { + id: gridLayout + columns: root.vertical ? 1 : -1 anchors { - verticalCenter: parent.verticalCenter - left: parent.left - right: parent.right - leftMargin: root.padding - rightMargin: root.padding + verticalCenter: root.vertical ? undefined : parent.verticalCenter + horizontalCenter: root.vertical ? parent.horizontalCenter : undefined + left: root.vertical ? undefined : parent.left + right: root.vertical ? undefined : parent.right + top: root.vertical ? parent.top : undefined + bottom: root.vertical ? parent.bottom : undefined + margins: root.padding } - spacing: 4 - + columnSpacing: 4 + rowSpacing: 12 } } \ No newline at end of file diff --git a/.config/quickshell/ii/modules/common/Appearance.qml b/.config/quickshell/ii/modules/common/Appearance.qml index 1e5ca689..870bbfe3 100644 --- a/.config/quickshell/ii/modules/common/Appearance.qml +++ b/.config/quickshell/ii/modules/common/Appearance.qml @@ -323,7 +323,6 @@ Singleton { property real baseBarHeight: 40 property real barHeight: Config.options.bar.cornerStyle === 1 ? (baseBarHeight + root.sizes.hyprlandGapsOut * 2) : baseBarHeight - property real barGroupHeight: 32 property real barCenterSideModuleWidth: Config.options?.bar.verbose ? 360 : 140 property real barCenterSideModuleWidthShortened: 280 property real barCenterSideModuleWidthHellaShortened: 190 @@ -344,7 +343,6 @@ Singleton { property real baseVerticalBarWidth: 46 property real verticalBarWidth: Config.options.bar.cornerStyle === 1 ? (baseVerticalBarWidth + root.sizes.hyprlandGapsOut * 2) : baseVerticalBarWidth - property real verticalBarGroupWidth: 38 } syntaxHighlightingTheme: root.m3colors.darkmode ? "Monokai" : "ayu Light" diff --git a/.config/quickshell/ii/modules/verticalBar/BatteryIndicator.qml b/.config/quickshell/ii/modules/verticalBar/BatteryIndicator.qml index 470214f4..7b358316 100644 --- a/.config/quickshell/ii/modules/verticalBar/BatteryIndicator.qml +++ b/.config/quickshell/ii/modules/verticalBar/BatteryIndicator.qml @@ -15,8 +15,6 @@ MouseArea { readonly property bool isLow: percentage <= Config.options.battery.low / 100 implicitHeight: batteryProgress.implicitHeight - implicitWidth: Appearance.sizes.verticalBarGroupWidth - hoverEnabled: true ClippedProgressBar { diff --git a/.config/quickshell/ii/modules/verticalBar/VerticalBarContent.qml b/.config/quickshell/ii/modules/verticalBar/VerticalBarContent.qml index ccb953e4..feaa5d9c 100644 --- a/.config/quickshell/ii/modules/verticalBar/VerticalBarContent.qml +++ b/.config/quickshell/ii/modules/verticalBar/VerticalBarContent.qml @@ -150,7 +150,8 @@ Item { // Bar content region anchors.centerIn: parent spacing: 4 - VerticalBarGroup { + Bar.BarGroup { + vertical: true padding: 8 Resources { Layout.fillWidth: true @@ -162,8 +163,9 @@ Item { // Bar content region visible: Config.options?.bar.borderless } - VerticalBarGroup { + Bar.BarGroup { id: middleCenterGroup + vertical: true padding: 6 Layout.fillHeight: true @@ -187,7 +189,8 @@ Item { // Bar content region visible: Config.options?.bar.borderless } - VerticalBarGroup { + Bar.BarGroup { + vertical: true padding: 8 VerticalClockWidget { diff --git a/.config/quickshell/ii/modules/verticalBar/VerticalBarGroup.qml b/.config/quickshell/ii/modules/verticalBar/VerticalBarGroup.qml deleted file mode 100644 index ef88aafb..00000000 --- a/.config/quickshell/ii/modules/verticalBar/VerticalBarGroup.qml +++ /dev/null @@ -1,37 +0,0 @@ -import qs.modules.common -import QtQuick -import QtQuick.Layouts - -Item { - id: root - property real padding: 5 - implicitWidth: Appearance.sizes.baseVerticalBarWidth - width: Appearance.sizes.verticalBarWidth - implicitHeight: columnLayout.implicitHeight + padding * 2 - default property alias items: columnLayout.children - - Rectangle { - id: background - anchors { - fill: parent - leftMargin: 4 - rightMargin: 4 - } - color: Config.options?.bar.borderless ? "transparent" : Appearance.colors.colLayer1 - radius: Appearance.rounding.small - } - - ColumnLayout { - id: columnLayout - anchors { - horizontalCenter: parent.horizontalCenter - top: parent.top - bottom: parent.bottom - topMargin: root.padding - bottomMargin: root.padding - } - spacing: 12 - - // Children defined by `items` prop - } -}