import { bind } from 'astal'; import { Gtk, Widget } from 'astal/gtk3'; import AstalWp from 'gi://AstalWp'; import { RadioButton } from '../misc/subclasses'; import Separator from '../misc/separator'; export default () => { const audio = AstalWp.get_default()?.get_audio(); if (!audio) { throw new Error('Could not find default audio devices.'); } // TODO: make a stack to have outputs, inputs and currently playing apps // TODO: figure out ports and profiles return ( {bind(audio, 'speakers').as((speakers) => { const widgets = speakers.map((speaker, i) => ( { if (i !== 0) { self.group = (((widgets[0] as Widget.Box) .get_children()[0] as Widget.Box) .get_children()[0] as RadioButton); } }} onButtonReleaseEvent={() => { speaker.isDefault = true; }} /> {/* FIXME: lockChannels not working TODO: have two sliders when lockChannels === false */} { speaker.set_volume(self.value); }} /> )); return widgets; })} ); };