battery shows how much time is left
This commit is contained in:
parent
b4e7d9c42a
commit
6aefb0eb18
@ -35,12 +35,14 @@ Rectangle {
|
|||||||
Text {
|
Text {
|
||||||
id: botText
|
id: botText
|
||||||
property var timeToEmpty: UPower.displayDevice.timeToEmpty / 60 / 60
|
property var timeToEmpty: UPower.displayDevice.timeToEmpty / 60 / 60
|
||||||
|
property var timeToFull: UPower.displayDevice.timeToFull / 60 / 60
|
||||||
|
property bool isCharging: UPower.displayDevice.state === UPowerDeviceState.Charging
|
||||||
font.weight: 600
|
font.weight: 600
|
||||||
font.family: Settings.font
|
font.family: Settings.font
|
||||||
font.pixelSize: Settings.fontSize - 2
|
font.pixelSize: Settings.fontSize - 2
|
||||||
opacity: 0.7
|
opacity: 0.7
|
||||||
color: Colors.foreground
|
color: Colors.foreground
|
||||||
text: timeToEmpty.toFixed(1) + "h left"
|
text: isCharging ? timeToFull.toFixed(1) + "h to full" : timeToEmpty.toFixed(1) + "h left"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user