bars: refractor bar groups

This commit is contained in:
end-4 2025-08-15 22:49:43 +07:00
parent 9fc0d26eb5
commit d05c451294
5 changed files with 26 additions and 59 deletions

View file

@ -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
}
}

View file

@ -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"

View file

@ -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 {

View file

@ -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 {

View file

@ -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
}
}