chore: migrate volume change sound to cosmic-osd

This commit is contained in:
Michael Aaron Murphy 2024-03-30 13:56:16 +01:00 committed by Michael Murphy
parent 52aa97945b
commit ed335b256a
3 changed files with 0 additions and 30 deletions

View file

@ -39,7 +39,6 @@ use mpris_subscription::MprisUpdate;
mod config;
mod mpris_subscription;
mod pipewire;
mod pulse;
static SHOW_MEDIA_CONTROLS: Lazy<id::Toggler> = Lazy::new(id::Toggler::unique);

View file

@ -1,21 +0,0 @@
// Copyright 2023 System76 <info@system76.com>
// SPDX-License-Identifier: MPL-2.0
use std::path::Path;
use std::process::Stdio;
/// Plays an audio file.
pub fn play(path: &Path) {
let _result = tokio::process::Command::new("pw-play")
.stdin(Stdio::null())
.stdout(Stdio::null())
.stderr(Stdio::null())
.arg(path)
.spawn();
}
pub fn play_audio_volume_change() {
play(Path::new(
"/usr/share/sounds/freedesktop/stereo/audio-volume-change.oga",
));
}

View file

@ -390,7 +390,6 @@ struct PulseServer {
mainloop: Rc<RefCell<Mainloop>>,
context: Rc<RefCell<Context>>,
introspector: Introspector,
last_playback: Instant,
}
#[derive(Clone, Debug)]
@ -437,7 +436,6 @@ impl PulseServer {
mainloop,
context,
introspector,
last_playback: Instant::now(),
})
}
@ -637,12 +635,6 @@ impl PulseServer {
.introspector
.set_sink_volume_by_name(name, volume, None);
self.wait_for_result(op).ok();
let now = Instant::now();
if now.duration_since(self.last_playback) > Duration::from_millis(250) {
self.last_playback = now;
crate::pipewire::play_audio_volume_change();
}
}
fn set_source_volume_by_name(&mut self, name: &str, volume: &ChannelVolumes) {