chore: migrate volume change sound to cosmic-osd
This commit is contained in:
parent
52aa97945b
commit
ed335b256a
3 changed files with 0 additions and 30 deletions
|
|
@ -39,7 +39,6 @@ use mpris_subscription::MprisUpdate;
|
||||||
|
|
||||||
mod config;
|
mod config;
|
||||||
mod mpris_subscription;
|
mod mpris_subscription;
|
||||||
mod pipewire;
|
|
||||||
mod pulse;
|
mod pulse;
|
||||||
|
|
||||||
static SHOW_MEDIA_CONTROLS: Lazy<id::Toggler> = Lazy::new(id::Toggler::unique);
|
static SHOW_MEDIA_CONTROLS: Lazy<id::Toggler> = Lazy::new(id::Toggler::unique);
|
||||||
|
|
|
||||||
|
|
@ -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",
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
@ -390,7 +390,6 @@ struct PulseServer {
|
||||||
mainloop: Rc<RefCell<Mainloop>>,
|
mainloop: Rc<RefCell<Mainloop>>,
|
||||||
context: Rc<RefCell<Context>>,
|
context: Rc<RefCell<Context>>,
|
||||||
introspector: Introspector,
|
introspector: Introspector,
|
||||||
last_playback: Instant,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
|
@ -437,7 +436,6 @@ impl PulseServer {
|
||||||
mainloop,
|
mainloop,
|
||||||
context,
|
context,
|
||||||
introspector,
|
introspector,
|
||||||
last_playback: Instant::now(),
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -637,12 +635,6 @@ impl PulseServer {
|
||||||
.introspector
|
.introspector
|
||||||
.set_sink_volume_by_name(name, volume, None);
|
.set_sink_volume_by_name(name, volume, None);
|
||||||
self.wait_for_result(op).ok();
|
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) {
|
fn set_source_volume_by_name(&mut self, name: &str, volume: &ChannelVolumes) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue