feat: added graphs to battery hover windows

This commit is contained in:
Honney
2026-09-02 14:54:00 +02:00
parent 510cbb0cec
commit f9c14c84b4
2 changed files with 90 additions and 23 deletions
+55 -23
View File
@@ -126,14 +126,6 @@ MouseArea {
Column {
spacing: parent.spacing
Text {
text: "percentage: " + BatteryState.percentage + "%"
wrapMode: Text.WordWrap
color: Colors.primary
anchors.horizontalCenter: parent.horizontalCenter
font.pixelSize: Config.font_size_tiny(bar.height)
font.family: Config.font
}
Text {
text: "State: " + BatteryState.state
wrapMode: Text.WordWrap
@@ -142,13 +134,61 @@ MouseArea {
font.pixelSize: Config.font_size_tiny(bar.height)
font.family: Config.font
}
Text {
text: "energy: " + Math.round(BatteryState.energy*10)/10 + " W"
wrapMode: Text.WordWrap
color: Colors.primary
anchors.horizontalCenter: parent.horizontalCenter
font.pixelSize: Config.font_size_tiny(bar.height)
font.family: Config.font
Column {
width: parent.width
spacing: 2
Text {
text: "percentage: " + BatteryState.percentage + "%"
color: Colors.primary
anchors.horizontalCenter: parent.horizontalCenter
font.pixelSize: Config.font_size_tiny(bar.height)
font.family: Config.font
}
Sparkline {
values: BatteryState.percentageHistory
lineColor: Colors.primary
width: parent.width
windowMs: BatteryState._maxHistory * 1000
}
}
Column {
width: parent.width
spacing: 2
Text {
text: "energy: " + Math.round(BatteryState.energy*10)/10 + " W"
color: Colors.primary
anchors.horizontalCenter: parent.horizontalCenter
font.pixelSize: Config.font_size_tiny(bar.height)
font.family: Config.font
}
Sparkline {
values: BatteryState.energyHistory
lineColor: Colors.primary
width: parent.width
windowMs: BatteryState._maxHistory * 1000
}
}
Column {
width: parent.width
spacing: 2
Text {
text: "Usage: " + BatteryState.energy_rate_formated + " W"
color: Colors.primary
anchors.horizontalCenter: parent.horizontalCenter
font.pixelSize: Config.font_size_tiny(bar.height)
font.family: Config.font
}
Sparkline {
values: BatteryState.usageHistory
lineColor: Colors.primary
width: parent.width
windowMs: BatteryState._maxHistory * 1000
}
}
Text {
text: (
@@ -161,14 +201,6 @@ MouseArea {
font.pixelSize: Config.font_size_tiny(bar.height)
font.family: Config.font
}
Text {
text: "Usage: " + BatteryState.energy_rate_formated + " W"
wrapMode: Text.WordWrap
color: Colors.primary
anchors.horizontalCenter: parent.horizontalCenter
font.pixelSize: Config.font_size_tiny(bar.height)
font.family: Config.font
}
Text {
text: "Health: " + BatteryState.health + " %"
visible: BatteryState.healthSupported