left-bar working, bottom bar semi-broken

This commit is contained in:
2026-08-14 16:31:52 +02:00
parent 1d150292d3
commit 4517e5ecd0
28 changed files with 404 additions and 168 deletions
+36 -10
View File
@@ -18,9 +18,10 @@ CustomClippingRect {
return i;
return -1;
}
required property bool horizontal
// Index of the first/last entry that isn't collapsed, for edge margin gating
readonly property alias items: row
readonly property alias items: grid
readonly property int lastPresent: {
const values = model.values;
for (let i = values.length - 1; i >= 0; i--)
@@ -28,6 +29,8 @@ CustomClippingRect {
return i;
return -1;
}
readonly property real shortSize: Config.bar.height + Appearance.padding.smallest * 2
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
// Entries that can shrink to nothing, spacing included
@@ -37,19 +40,37 @@ CustomClippingRect {
return false;
}
bottomLeftRadius: Appearance.rounding.smallest / 2
anchors.fill: parent
bottomLeftRadius: horizontal ? Appearance.rounding.smallest / 2 : Appearance.rounding.full
color: DynamicColors.tPalette.m3surfaceContainer
implicitHeight: Config.bar.height + Appearance.padding.smallest * 2
implicitWidth: row.implicitWidth + Appearance.padding.small * 2
implicitHeight: horizontal ? shortSize : size
implicitWidth: horizontal ? size : shortSize
radius: Appearance.rounding.full
topLeftRadius: Appearance.rounding.smallest / 2
topRightRadius: horizontal ? Appearance.rounding.full : Appearance.rounding.smallest / 2
RowLayout {
id: row
Behavior on implicitHeight {
enabled: !root.horizontal
Anim {
}
}
Behavior on implicitWidth {
enabled: root.horizontal
Anim {
}
}
GridLayout {
id: grid
anchors.bottomMargin: root.horizontal ? 0 : Appearance.padding.small
anchors.fill: parent
anchors.leftMargin: Appearance.padding.small
anchors.rightMargin: Appearance.padding.small
anchors.leftMargin: root.horizontal ? Appearance.padding.small : 0
anchors.rightMargin: root.horizontal ? Appearance.padding.small : 0
anchors.topMargin: root.horizontal ? 0 : Appearance.padding.small
columns: root.horizontal ? -1 : 1
Repeater {
model: ScriptModel {
@@ -68,6 +89,7 @@ CustomClippingRect {
name: "audio"
AudioWidget {
horizontal: root.horizontal
}
}
}
@@ -79,6 +101,7 @@ CustomClippingRect {
name: "audio"
MicWidget {
horizontal: root.horizontal
}
}
}
@@ -90,6 +113,7 @@ CustomClippingRect {
name: "upower"
UPowerWidget {
horizontal: root.horizontal
}
}
}
@@ -108,8 +132,10 @@ CustomClippingRect {
property real rightGap: present && index !== root.firstPresent ? margin : 0
Layout.alignment: Qt.AlignHCenter
Layout.leftMargin: Math.round(leftGap)
Layout.rightMargin: Math.round(rightGap)
Layout.bottomMargin: root.horizontal ? 0 : Math.round(rightGap)
Layout.leftMargin: root.horizontal ? Math.round(leftGap) : 0
Layout.rightMargin: root.horizontal ? Math.round(rightGap) : 0
Layout.topMargin: root.horizontal ? 0 : Math.round(leftGap)
children: item
implicitHeight: item?.implicitHeight ?? 0
implicitWidth: item?.implicitWidth ?? 0