forked from Shinonome/dots-hyprland
bar: battery indicator: remove useless RowLayout
This commit is contained in:
@@ -13,46 +13,40 @@ MouseArea {
|
|||||||
readonly property real percentage: Battery.percentage
|
readonly property real percentage: Battery.percentage
|
||||||
readonly property bool isLow: percentage <= Config.options.battery.low / 100
|
readonly property bool isLow: percentage <= Config.options.battery.low / 100
|
||||||
|
|
||||||
implicitWidth: rowLayout.implicitWidth + rowLayout.spacing * 2
|
implicitWidth: batteryProgress.implicitWidth
|
||||||
implicitHeight: Appearance.sizes.barHeight
|
implicitHeight: Appearance.sizes.barHeight
|
||||||
|
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
|
|
||||||
RowLayout {
|
ClippedProgressBar {
|
||||||
id: rowLayout
|
id: batteryProgress
|
||||||
|
|
||||||
spacing: 4
|
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
value: percentage
|
||||||
|
highlightColor: (isLow && !isCharging) ? Appearance.m3colors.m3error : Appearance.colors.colOnSecondaryContainer
|
||||||
|
|
||||||
ClippedProgressBar {
|
Item {
|
||||||
id: batteryProgress
|
anchors.centerIn: parent
|
||||||
value: percentage
|
width: batteryProgress.valueBarWidth
|
||||||
highlightColor: (isLow && !isCharging) ? Appearance.m3colors.m3error : Appearance.colors.colOnSecondaryContainer
|
height: batteryProgress.valueBarHeight
|
||||||
|
|
||||||
Item {
|
RowLayout {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
width: batteryProgress.valueBarWidth
|
spacing: 0
|
||||||
height: batteryProgress.valueBarHeight
|
|
||||||
|
|
||||||
RowLayout {
|
MaterialSymbol {
|
||||||
anchors.centerIn: parent
|
id: boltIcon
|
||||||
spacing: 0
|
Layout.alignment: Qt.AlignVCenter
|
||||||
|
Layout.leftMargin: -2
|
||||||
MaterialSymbol {
|
Layout.rightMargin: -2
|
||||||
id: boltIcon
|
fill: 1
|
||||||
Layout.alignment: Qt.AlignVCenter
|
text: "bolt"
|
||||||
Layout.leftMargin: -2
|
iconSize: Appearance.font.pixelSize.smaller
|
||||||
Layout.rightMargin: -2
|
visible: isCharging && percentage < 1 // TODO: animation
|
||||||
fill: 1
|
}
|
||||||
text: "bolt"
|
StyledText {
|
||||||
iconSize: Appearance.font.pixelSize.smaller
|
Layout.alignment: Qt.AlignVCenter
|
||||||
visible: isCharging && percentage < 1 // TODO: animation
|
font: batteryProgress.font
|
||||||
}
|
text: batteryProgress.text
|
||||||
StyledText {
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
font: batteryProgress.font
|
|
||||||
text: batteryProgress.text
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user