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.description.localeCompare(b.description)) .map((stream) => ( { if (!group) { group = self; } else { self.group = group; } self.active = stream.isDefault; self.hook(stream, 'notify::is-default', () => { self.active = stream.isDefault; }); }} onButtonReleaseEvent={() => { stream.isDefault = true; }} /> { stream.set_volume(self.value); }} /> )); };