RAGS - v1.10.0
    Preparing search index...
    Note

    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: writable
    • devices: Device[]
    • connected-devices: Device[]
    • toggle: () => void
    • getDevice: (address: string) => Device
    • address: string
    • battery-level: number
    • battery-percentage: number
    • connected: boolean
    • icon-name: string
    • alias: string
    • name: string
    • trusted: boolean
    • paired: boolean
    • setConnection: (connect: boolean) => void
    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`
    ),
    });