import { bind } from 'astal'; import { Gtk } from 'astal/gtk3'; import AstalWp from 'gi://AstalWp'; import { RadioButton } from '../misc/subclasses'; import Separator from '../misc/separator'; export default (streams: AstalWp.Endpoint[]) => { let group: RadioButton | undefined; return streams .sort((a, b) => a.get_description().localeCompare(b.get_description())) .map((stream) => ( { if (!group) { group = self; } else { self.group = group; } self.active = stream.get_is_default(); self.hook(stream, 'notify::is-default', () => { self.active = stream.get_is_default(); }); }} onButtonReleaseEvent={() => { stream.set_is_default(true); }} /> { stream.set_volume(self.value); }} /> )); };