sidebar: show bluetooth device battery

This commit is contained in:
2 * r + 2 * t 2025-03-26 20:51:19 +11:00
parent 0ab689ab98
commit 8772a05a90

View file

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