import { bind } from 'astal'; import { Gtk } from 'astal/gtk3'; import AstalBluetooth from 'gi://AstalBluetooth'; import { ToggleButton } from '../misc/subclasses'; import Separator from '../misc/separator'; import DeviceWidget from './device'; export default () => { const bluetooth = AstalBluetooth.get_default(); return ( { self.connect('notify::active', () => { bluetooth.adapter?.set_powered(self.active); }); }} /> { self.toggleClassName('active', self.active); if (self.active) { bluetooth.adapter?.start_discovery(); } else { bluetooth.adapter?.stop_discovery(); } }} > {bind(bluetooth, 'devices').as((devices) => devices .filter((dev) => dev.name) .map((dev) => DeviceWidget(dev)))} ); };