fix(ags audio): misc fixes
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-12-14 22:14:56 -05:00
parent ce6d31e658
commit a33fc66b15
3 changed files with 140 additions and 112 deletions

View file

@ -24,23 +24,44 @@ export default () => {
transitionType={Gtk.StackTransitionType.SLIDE_LEFT_RIGHT} transitionType={Gtk.StackTransitionType.SLIDE_LEFT_RIGHT}
> >
<scrollable name="outputs" hscroll={Gtk.PolicyType.NEVER}> <scrollable
name="outputs"
hscroll={Gtk.PolicyType.NEVER}
setup={(self) => setTimeout(() => {
self.add((
<box vertical> <box vertical>
{bind(audio, 'speakers').as(Streams)} {bind(audio, 'speakers').as(Streams)}
</box> </box>
</scrollable> ));
}, 1000)}
/>
<scrollable name="inputs" hscroll={Gtk.PolicyType.NEVER}> <scrollable
name="inputs"
hscroll={Gtk.PolicyType.NEVER}
setup={(self) => setTimeout(() => {
self.add((
<box vertical> <box vertical>
{bind(audio, 'microphones').as(Streams)} {bind(audio, 'microphones').as(Streams)}
</box> </box>
</scrollable> ));
}, 1000)}
/>
<scrollable name="profiles" hscroll={Gtk.PolicyType.NEVER}> <scrollable
name="profiles"
hscroll={Gtk.PolicyType.NEVER}
setup={(self) => setTimeout(() => {
self.add((
<box vertical> <box vertical>
{bind(audio, 'devices').as(Profiles)} {bind(audio, 'devices').as(Profiles)}
</box> </box>
</scrollable> ));
}, 1000)}
/>
</stack> </stack>
) as Widget.Stack; ) as Widget.Stack;

View file

@ -5,7 +5,9 @@ import AstalWp from 'gi://AstalWp';
import { ComboBoxText } from '../misc/subclasses'; import { ComboBoxText } from '../misc/subclasses';
export default (devices: AstalWp.Device[]) => devices.map((device) => ( export default (devices: AstalWp.Device[]) => devices
.sort((a, b) => a.description.localeCompare(b.description))
.map((device) => (
<box className="stream" vertical> <box className="stream" vertical>
<label label={bind(device, 'description')} /> <label label={bind(device, 'description')} />
@ -41,4 +43,4 @@ export default (devices: AstalWp.Device[]) => devices.map((device) => (
/> />
</box> </box>
)); ));

View file

@ -10,7 +10,9 @@ import Separator from '../misc/separator';
export default (streams: AstalWp.Endpoint[]) => { export default (streams: AstalWp.Endpoint[]) => {
let group: RadioButton | undefined; let group: RadioButton | undefined;
return streams.map((stream) => ( return streams
.sort((a, b) => a.description.localeCompare(b.description))
.map((stream) => (
<box className="stream" vertical> <box className="stream" vertical>
<box className="title"> <box className="title">
@ -19,8 +21,6 @@ export default (streams: AstalWp.Endpoint[]) => {
cursor="pointer" cursor="pointer"
css="margin-top: 1px;" css="margin-top: 1px;"
active={bind(stream, 'isDefault')}
onRealize={(self) => { onRealize={(self) => {
if (!group) { if (!group) {
group = self; group = self;
@ -28,6 +28,11 @@ export default (streams: AstalWp.Endpoint[]) => {
else { else {
self.group = group; self.group = group;
} }
self.active = stream.isDefault;
self.hook(stream, 'notify::is-default', () => {
self.active = stream.isDefault;
});
}} }}
onButtonReleaseEvent={() => { onButtonReleaseEvent={() => {