package dependency: gnome-bluetooth-3.0 for the battery percentage to work,
make sure you have Experimental = true in /etc/bluetooth/main.conf
device-added: (address: string)device-removed: (address: string)enabled: boolean: writabledevices: Device[]connected-devices: Device[]toggle: () => voidgetDevice: (address: string) => Deviceaddress: stringbattery-level: numberbattery-percentage: numberconnected: booleanicon-name: stringalias: stringname: stringtrusted: booleanpaired: booleansetConnection: (connect: boolean) => voidconst bluetooth = await Service.import("bluetooth");
const connectedList = Widget.Box({
setup: (self) =>
self.hook(bluetooth, (self) => {
self.children = bluetooth.connected_devices
.map(({ icon_name, name }) =>
Widget.Box([
Widget.Icon(icon_name + "-symbolic"),
Widget.Label(name),
])
);
self.visible = bluetooth.connected_devices.length > 0;
}, "notify::connected-devices"),
});
const indicator = Widget.Icon({
icon: bluetooth.bind("enabled").as((on) =>
`bluetooth-${on ? "active" : "disabled"}-symbolic`
),
});