fix(sound): reset page state on leave

This commit is contained in:
Michael Aaron Murphy 2024-08-13 18:12:00 +02:00
parent aedf8ea2af
commit f544031db7
No known key found for this signature in database
GPG key ID: B2732D4240C9212C

View file

@ -15,25 +15,25 @@ use slotmap::SlotMap;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub enum Message { pub enum Message {
// Get default sinks/sources and their volumes/mute status. /// Get default sinks/sources and their volumes/mute status.
Pulse(pulse::Event), Pulse(pulse::Event),
// Get ALSA cards and their profiles. /// Get ALSA cards and their profiles.
Pipewire(pipewire::DeviceEvent), Pipewire(pipewire::DeviceEvent),
// Change the default microphone input. /// Change the default microphone input.
SinkChanged(usize), SinkChanged(usize),
// Request to change the default microphone volume. /// Request to change the default microphone volume.
SinkVolumeChanged(u32), SinkVolumeChanged(u32),
// Change the microphone volume. /// Change the microphone volume.
SinkVolumeApply(NodeId), SinkVolumeApply(NodeId),
// Toggle the mute status of the microphone. /// Toggle the mute status of the microphone.
SinkMuteToggle, SinkMuteToggle,
// Change the default speaker output. /// Change the default speaker output.
SourceChanged(usize), SourceChanged(usize),
// Request to change the speaker volume. /// Request to change the speaker volume.
SourceVolumeChanged(u32), SourceVolumeChanged(u32),
// Change the speaker volume. /// Change the speaker volume.
SourceVolumeApply(NodeId), SourceVolumeApply(NodeId),
// Toggle the mute status of the speaker output. /// Toggle the mute status of the speaker output.
SourceMuteToggle, SourceMuteToggle,
} }
@ -169,6 +169,8 @@ impl page::Page<crate::pages::Message> for Page {
_ = terminate.send(()); _ = terminate.send(());
} }
*self = Page::default();
Command::none() Command::none()
} }
} }