cosmic-applets/cosmic-applet-audio/src/pipewire.rs
2024-02-06 16:21:48 -05:00

21 lines
511 B
Rust

// 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",
));
}