left-bar working, bottom bar semi-broken
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -11,24 +11,30 @@ import qs.Modules
|
||||
CustomClippingRect {
|
||||
id: root
|
||||
|
||||
required property bool horizontal
|
||||
readonly property alias items: repeater
|
||||
readonly property alias layout: sysRow
|
||||
required property RowLayout loader
|
||||
readonly property alias layout: sysGrid
|
||||
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 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
|
||||
implicitHeight: Config.bar.height + Appearance.padding.smallest * 2
|
||||
implicitWidth: sysRow.implicitWidth + Appearance.padding.small * 2
|
||||
implicitHeight: horizontal ? shortSize : size
|
||||
implicitWidth: horizontal ? size : shortSize
|
||||
radius: Appearance.rounding.full
|
||||
topRightRadius: Appearance.rounding.smallest / 2
|
||||
topRightRadius: horizontal ? Appearance.rounding.smallest / 2 : Appearance.rounding.full
|
||||
|
||||
RowLayout {
|
||||
id: sysRow
|
||||
GridLayout {
|
||||
id: sysGrid
|
||||
|
||||
anchors.centerIn: parent
|
||||
spacing: 0
|
||||
columns: root.horizontal ? -1 : 1
|
||||
rowSpacing: -2
|
||||
|
||||
Repeater {
|
||||
id: repeater
|
||||
|
||||
@@ -12,10 +12,10 @@ Item {
|
||||
id: root
|
||||
|
||||
property bool current: popouts.currentName.startsWith(`traymenu${ind}`) && popouts.hasCurrent
|
||||
readonly property real dpr: Hypr.monitorFor(loader.screen).scale
|
||||
readonly property real dpr: Hypr.monitorFor(loader?.screen).scale
|
||||
required property int ind
|
||||
required property SystemTrayItem item
|
||||
required property RowLayout loader
|
||||
required property GridLayout loader
|
||||
required property Wrapper popouts
|
||||
|
||||
function resolveIcon(app: string, icon: string): string {
|
||||
|
||||
@@ -8,12 +8,15 @@ import qs.Config
|
||||
import qs.Modules.SysTray.Widgets
|
||||
import qs.Modules
|
||||
|
||||
RowLayout {
|
||||
GridLayout {
|
||||
id: root
|
||||
|
||||
required property bool horizontal
|
||||
readonly property alias items: repeater
|
||||
required property RowLayout loader
|
||||
required property GridLayout loader
|
||||
required property Wrapper popouts
|
||||
readonly property real shortSize: Config.bar.height + Appearance.padding.smallest * 2
|
||||
readonly property real size: horizontal ? sysTray.implicitWidth + sysTrayMod.implicitWidth + Appearance.padding.small : sysTray.implicitHeight + sysTrayMod.implicitHeight + Appearance.padding.small
|
||||
|
||||
function closestRowChild(row, x) {
|
||||
let child = row.childAt(x, row.height / 2);
|
||||
@@ -80,9 +83,11 @@ RowLayout {
|
||||
return null;
|
||||
}
|
||||
|
||||
height: Config.bar.height + Appearance.padding.smallest * 2
|
||||
spacing: Appearance.padding.small
|
||||
width: sysTray.implicitWidth + sysTrayMod.implicitWidth + Appearance.padding.small
|
||||
columnSpacing: Appearance.padding.small
|
||||
columns: horizontal ? -1 : 1
|
||||
height: horizontal ? shortSize : size
|
||||
rowSpacing: Appearance.padding.small
|
||||
width: horizontal ? size : shortSize
|
||||
|
||||
CustomClippingRect {
|
||||
id: sysTray
|
||||
@@ -94,11 +99,18 @@ RowLayout {
|
||||
radius: Appearance.rounding.full
|
||||
topRightRadius: Appearance.rounding.smallest / 2
|
||||
|
||||
Row {
|
||||
GridLayout {
|
||||
id: sysRow
|
||||
|
||||
anchors.bottom: root.horizontal ? undefined : parent.bottom
|
||||
anchors.centerIn: parent
|
||||
spacing: 0
|
||||
anchors.horizontalCenter: root.horizontal ? parent.horizontalCenter : undefined
|
||||
anchors.left: root.horizontal ? undefined : parent.left
|
||||
anchors.right: root.horizontal ? undefined : parent.right
|
||||
anchors.verticalCenter: root.horizontal ? parent.verticalCenter : undefined
|
||||
columnSpacing: Appearance.spacing.small / 2
|
||||
columns: root.horizontal ? -1 : 1
|
||||
rowSpacing: Appearance.spacing.small / 2
|
||||
|
||||
Repeater {
|
||||
id: repeater
|
||||
@@ -125,10 +137,12 @@ RowLayout {
|
||||
CustomClippingRect {
|
||||
id: sysTrayMod
|
||||
|
||||
Layout.fillHeight: true
|
||||
Layout.fillHeight: root.horizontal
|
||||
Layout.fillWidth: !root.horizontal
|
||||
bottomLeftRadius: Appearance.rounding.smallest / 2
|
||||
color: DynamicColors.tPalette.m3surfaceContainer
|
||||
implicitWidth: sysIcons.implicitWidth + Appearance.padding.smaller + Appearance.padding.normal
|
||||
implicitHeight: root.horizontal ? sysIcons.implicitHeight : sysIcons.implicitHeight + Appearance.padding.smaller + Appearance.padding.normal
|
||||
implicitWidth: root.horizontal ? sysIcons.implicitWidth + Appearance.padding.smaller + Appearance.padding.normal : sysIcons.implicitWidth
|
||||
radius: Appearance.rounding.full
|
||||
topLeftRadius: Appearance.rounding.smallest / 2
|
||||
|
||||
@@ -138,6 +152,7 @@ RowLayout {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: Appearance.padding.smaller
|
||||
anchors.rightMargin: Appearance.padding.normal
|
||||
horizontal: root.horizontal
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,10 +10,12 @@ import qs.Components
|
||||
MaterialIcon {
|
||||
id: speaker
|
||||
|
||||
required property bool horizontal
|
||||
|
||||
animate: true
|
||||
color: Audio.muted ? DynamicColors.palette.m3error : DynamicColors.palette.m3onSurface
|
||||
fill: 1
|
||||
font.pointSize: Appearance.font.size.larger
|
||||
font.pointSize: horizontal ? Appearance.font.size.larger : Appearance.font.size.large
|
||||
text: Audio.muted ? "volume_off" : "volume_up"
|
||||
|
||||
Behavior on Layout.maximumWidth {
|
||||
|
||||
@@ -10,10 +10,12 @@ import qs.Components
|
||||
MaterialIcon {
|
||||
id: mic
|
||||
|
||||
required property bool horizontal
|
||||
|
||||
animate: true
|
||||
color: (Audio.sourceMuted ?? false) ? DynamicColors.palette.m3error : DynamicColors.palette.m3onSurface
|
||||
fill: 1
|
||||
font.pointSize: Appearance.font.size.larger
|
||||
font.pointSize: horizontal ? Appearance.font.size.larger : Appearance.font.size.large
|
||||
text: Audio.sourceMuted ? "mic_off" : "mic"
|
||||
|
||||
Behavior on Layout.maximumWidth {
|
||||
|
||||
@@ -8,6 +8,8 @@ import qs.Helpers
|
||||
Item {
|
||||
id: root
|
||||
|
||||
required property bool horizontal
|
||||
|
||||
implicitHeight: Battery.isLaptop ? batteryIconLoader.item.implicitHeight : upowerIconLoader.item.implicitHeight
|
||||
implicitWidth: Battery.isLaptop ? batteryIconLoader.item.implicitWidth : upowerIconLoader.item.implicitWidth
|
||||
|
||||
@@ -123,6 +125,7 @@ Item {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
animate: true
|
||||
fill: 1
|
||||
font.pointSize: root.horizontal ? Appearance.font.size.larger : Appearance.font.size.large
|
||||
text: {
|
||||
if (PowerProfiles.profile === PowerProfile.PowerSaver)
|
||||
return "energy_savings_leaf";
|
||||
|
||||
Reference in New Issue
Block a user