Bluetooth
signals
device-added:(address: string)device-removed:(address: string)
properties
enabled:boolean: writabledevices:Device[]connected-devices:Device[]
methods
toggle:() => voidgetDevice:(address: string) => Device
Device
properties
address:stringbattery-level:numberbattery-percentage:numberconnected:booleanicon-name:stringalias:stringname:stringtrusted:booleanpaired:boolean
methods
setConnection:(connect: boolean) => void
Example Widgets
const 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`),})