diff --git a/nixosModules/ags/config/widgets/audio/main.tsx b/nixosModules/ags/config/widgets/audio/main.tsx index b4686b79..98ee0174 100644 --- a/nixosModules/ags/config/widgets/audio/main.tsx +++ b/nixosModules/ags/config/widgets/audio/main.tsx @@ -3,12 +3,10 @@ import { Gtk, Widget } from 'astal/gtk3'; import AstalWp from 'gi://AstalWp'; -import Separator from '../misc/separator'; import Streams from './streams'; +import Profiles from './profiles'; -const ICON_SEP = 6; - export default () => { const audio = AstalWp.get_default()?.get_audio(); @@ -16,9 +14,6 @@ export default () => { 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 - const Shown = Variable('outputs'); const stack = ( @@ -26,6 +21,7 @@ export default () => { shown={bind(Shown)} transitionType={Gtk.StackTransitionType.SLIDE_LEFT_RIGHT} > + {bind(audio, 'speakers').as(Streams)} @@ -37,6 +33,13 @@ export default () => { {bind(audio, 'microphones').as(Streams)} + + + + {bind(audio, 'devices').as(Profiles)} + + + ) as Widget.Stack; @@ -52,10 +55,6 @@ export default () => { > - - - - ) as Widget.Button; @@ -71,11 +70,10 @@ export default () => { > + {stack} - - ); }; diff --git a/nixosModules/ags/config/widgets/audio/profiles.tsx b/nixosModules/ags/config/widgets/audio/profiles.tsx new file mode 100644 index 00000000..e9e14654 --- /dev/null +++ b/nixosModules/ags/config/widgets/audio/profiles.tsx @@ -0,0 +1,44 @@ +import { bind } from 'astal'; + +import AstalWp from 'gi://AstalWp'; + +import { ComboBoxText } from '../misc/subclasses'; + + +export default (devices: AstalWp.Device[]) => devices.map((device) => ( + + + +)); diff --git a/nixosModules/ags/config/widgets/misc/subclasses.tsx b/nixosModules/ags/config/widgets/misc/subclasses.tsx index 59c5b596..fde7b9c7 100644 --- a/nixosModules/ags/config/widgets/misc/subclasses.tsx +++ b/nixosModules/ags/config/widgets/misc/subclasses.tsx @@ -49,3 +49,14 @@ export class ProgressBar extends astalify(Gtk.ProgressBar) { super(props as any); } } + +@register() +export class ComboBoxText extends astalify(Gtk.ComboBoxText) { + constructor(props: ConstructProps< + ComboBoxText, + Gtk.ComboBoxText.ConstructorProps + > = {}) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + super(props as any); + } +}