sidebar: bluetooth device battery no NaN

This commit is contained in:
2 * r + 2 * t 2025-04-02 15:34:52 +11:00
parent 38197e7ab5
commit 282c8a65c2

View file

@ -26,7 +26,7 @@ const BluetoothDevice = (device: AstalBluetooth.Device) => (
const update = () => {
self.label =
(device.connected ? "Connected" : "Paired") +
(device.batteryPercentage !== -1 ? ` (${device.batteryPercentage * 100}%)` : "");
(device.batteryPercentage >= 0 ? ` (${device.batteryPercentage * 100}%)` : "");
self.visible = device.connected || device.paired;
};
self.hook(device, "notify::connected", update);