diff --git a/nixosModules/ags/config/widgets/audio/_index.scss b/nixosModules/ags/config/widgets/audio/_index.scss index 49fe8ab4..71949687 100644 --- a/nixosModules/ags/config/widgets/audio/_index.scss +++ b/nixosModules/ags/config/widgets/audio/_index.scss @@ -7,5 +7,15 @@ padding: 10px; border-radius: 8px; background-color: color.adjust(colors.$window_bg_color, $lightness: -3%); + + .body { + .toggle { + padding: 5px; + + icon { + font-size: 26px; + } + } + } } } diff --git a/nixosModules/ags/config/widgets/audio/main.tsx b/nixosModules/ags/config/widgets/audio/main.tsx index 277f481e..d891cc86 100644 --- a/nixosModules/ags/config/widgets/audio/main.tsx +++ b/nixosModules/ags/config/widgets/audio/main.tsx @@ -3,7 +3,7 @@ import { Gtk, Widget } from 'astal/gtk3'; import AstalWp from 'gi://AstalWp'; -import { RadioButton, ToggleButton } from '../misc/subclasses'; +import { RadioButton } from '../misc/subclasses'; import Separator from '../misc/separator'; @@ -17,95 +17,100 @@ export default () => { // TODO: make a stack to have outputs, inputs and currently playing apps // TODO: figure out ports and profiles - const defaultGroup = new RadioButton(); - return ( - {bind(audio, 'speakers').as((speakers) => speakers.map((speaker) => ( - - - { + const widgets = speakers.map((speaker, i) => ( + - setup={(self) => { - speaker.connect('notify::isDefault', () => { - self.active = speaker.isDefault; - }); - }} + - onToggled={(self) => { - speaker.isDefault = self.active; - }} - /> + + active={bind(speaker, 'isDefault')} - + onRealize={(self) => { + if (i !== 0) { + self.group = (((widgets[0] as Widget.Box) + .get_children()[0] as Widget.Box) + .get_children()[0] as RadioButton); + } + }} - - - - { - speaker.set_mute(self.active); - - (self.get_child() as Widget.Icon).icon = self.active ? - 'audio-volume-muted-symbolic' : - 'audio-speakers-symbolic'; - }} - > - { + speaker.isDefault = true; + }} /> - - + - {/* - FIXME: lockChannels not working - TODO: have two sliders when lockChannels === false - */} - - active={speaker.lockChannels} - onToggled={(self) => { - speaker.set_lock_channels(self.active); + - (self.get_child() as Widget.Icon).icon = self.active ? - 'channel-secure-symbolic' : - 'channel-insecure-symbolic'; - }} - > - + + + + + + + + {/* + FIXME: lockChannels not working + TODO: have two sliders when lockChannels === false + */} + + + { + speaker.set_volume(self.value); + }} /> - - - value={bind(speaker, 'volume')} - onDragged={(self) => { - speaker.set_volume(self.value); - }} - /> - - )))} + )); + + return widgets; + })} + ); };