From a33fc66b15f9b1ca43b61298f5b15e656810d9db Mon Sep 17 00:00:00 2001 From: matt1432 Date: Sat, 14 Dec 2024 22:14:56 -0500 Subject: [PATCH] fix(ags audio): misc fixes --- .../ags/config/widgets/audio/main.tsx | 51 +++++-- .../ags/config/widgets/audio/profiles.tsx | 64 ++++---- .../ags/config/widgets/audio/streams.tsx | 137 +++++++++--------- 3 files changed, 140 insertions(+), 112 deletions(-) diff --git a/nixosModules/ags/config/widgets/audio/main.tsx b/nixosModules/ags/config/widgets/audio/main.tsx index 3a93d938..f0dde3ac 100644 --- a/nixosModules/ags/config/widgets/audio/main.tsx +++ b/nixosModules/ags/config/widgets/audio/main.tsx @@ -24,23 +24,44 @@ export default () => { transitionType={Gtk.StackTransitionType.SLIDE_LEFT_RIGHT} > - - - {bind(audio, 'speakers').as(Streams)} - - + - - {bind(audio, 'microphones').as(Streams)} - - + setup={(self) => setTimeout(() => { + self.add(( + + {bind(audio, 'speakers').as(Streams)} + + )); + }, 1000)} + /> - - - {bind(audio, 'devices').as(Profiles)} - - + setTimeout(() => { + self.add(( + + {bind(audio, 'microphones').as(Streams)} + + )); + }, 1000)} + /> + + setTimeout(() => { + self.add(( + + {bind(audio, 'devices').as(Profiles)} + + )); + }, 1000)} + /> ) as Widget.Stack; diff --git a/nixosModules/ags/config/widgets/audio/profiles.tsx b/nixosModules/ags/config/widgets/audio/profiles.tsx index e9e14654..948b6515 100644 --- a/nixosModules/ags/config/widgets/audio/profiles.tsx +++ b/nixosModules/ags/config/widgets/audio/profiles.tsx @@ -5,40 +5,42 @@ import AstalWp from 'gi://AstalWp'; 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) => ( + - -)); + + )); diff --git a/nixosModules/ags/config/widgets/audio/streams.tsx b/nixosModules/ags/config/widgets/audio/streams.tsx index e4487361..692f9ea7 100644 --- a/nixosModules/ags/config/widgets/audio/streams.tsx +++ b/nixosModules/ags/config/widgets/audio/streams.tsx @@ -10,82 +10,87 @@ import Separator from '../misc/separator'; export default (streams: AstalWp.Endpoint[]) => { let group: RadioButton | undefined; - return streams.map((stream) => ( - + return streams + .sort((a, b) => a.description.localeCompare(b.description)) + .map((stream) => ( + - + - { - if (!group) { - group = self; - } - else { - self.group = group; - } - }} - - onButtonReleaseEvent={() => { - stream.isDefault = true; - }} - /> - - - - - - - - - - - + - - value={bind(stream, 'volume')} - onDragged={(self) => { - stream.set_volume(self.value); - }} - /> + + + + + + + + + + + { + stream.set_volume(self.value); + }} + /> + + - - - )); + )); };