fix battery icon on LockScreen

This commit is contained in:
notiant
2026-01-23 00:05:05 +01:00
committed by GitHub
parent a03fd669f3
commit 9f4ffacbaf
4 changed files with 17 additions and 5 deletions
+6 -1
View File
@@ -87,6 +87,7 @@ Loader {
property bool isReady: initializationComplete && BatteryService.batteryReady
property real percent: BatteryService.batteryPercentage
property bool charging: BatteryService.batteryCharging
property bool pluggedIn: BatteryService.batteryPluggedIn
property bool batteryVisible: isReady && percent > 0 && BatteryService.hasAnyBattery()
}
@@ -279,9 +280,13 @@ Loader {
Keys.onPressed: function (event) {
if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
lockContext.tryUnlock();
event.accepted = true;
}
if (event.key === Qt.Key_Escape && panelComponent.timerActive) {
panelComponent.cancelTimer();
event.accepted = true;
}
}
Component.onCompleted: forceActiveFocus()
}
+2 -2
View File
@@ -132,7 +132,7 @@ Item {
visible: batteryIndicator.isReady && BatteryService.hasAnyBattery()
NIcon {
icon: BatteryService.getIcon(Math.round(batteryIndicator.percent), batteryIndicator.charging, batteryIndicator.isReady)
icon: BatteryService.getIcon(Math.round(batteryIndicator.percent), batteryIndicator.charging, batteryIndicator.pluggedIn, batteryIndicator.isReady)
pointSize: Style.fontSizeM
color: batteryIndicator.charging ? Color.mPrimary : Color.mOnSurfaceVariant
}
@@ -457,7 +457,7 @@ Item {
visible: batteryIndicator.isReady && BatteryService.hasAnyBattery()
NIcon {
icon: BatteryService.getIcon(Math.round(batteryIndicator.percent), batteryIndicator.charging, batteryIndicator.isReady)
icon: BatteryService.getIcon(Math.round(batteryIndicator.percent), batteryIndicator.charging, batteryIndicator.pluggedIn, batteryIndicator.isReady)
pointSize: Style.fontSizeM
color: batteryIndicator.charging ? Color.mPrimary : Color.mOnSurfaceVariant
}
@@ -164,7 +164,7 @@ NBox {
NIcon {
icon: {
var b = BluetoothService.getBatteryPercent(modelData);
return BatteryService.getIcon(b !== null ? b : 0, false, b !== null);
return BatteryService.getIcon(b !== null ? b : 0, false, false, b !== null);
}
pointSize: Style.fontSizeXS
color: getContentColor(Color.mOnSurface)
@@ -347,7 +347,7 @@ NBox {
NIcon {
icon: {
var b = BluetoothService.getBatteryPercent(modelData);
return BatteryService.getIcon(b !== null ? b : 0, false, b !== null);
return BatteryService.getIcon(b !== null ? b : 0, false, false, b !== null);
}
pointSize: Style.fontSizeXS
color: Color.mOnSurface