sidebar: show bluetooth device battery
This commit is contained in:
parent
0ab689ab98
commit
8772a05a90
1 changed files with 3 additions and 1 deletions
|
|
@ -24,7 +24,9 @@ const BluetoothDevice = (device: AstalBluetooth.Device) => (
|
||||||
xalign={0}
|
xalign={0}
|
||||||
setup={self => {
|
setup={self => {
|
||||||
const update = () => {
|
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.visible = device.connected || device.paired;
|
||||||
};
|
};
|
||||||
self.hook(device, "notify::connected", update);
|
self.hook(device, "notify::connected", update);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue