Skip to content

Commit 6b860ad

Browse files
committed
chore(sound): remove unnecessary workaround
1 parent 4da6b98 commit 6b860ad

File tree

1 file changed

+0
-42
lines changed

1 file changed

+0
-42
lines changed

subscriptions/sound/src/lib.rs

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use cosmic::iced_futures::MaybeSend;
1111
use futures::{Stream, StreamExt};
1212
use intmap::IntMap;
1313
use std::{sync::Arc, time::Duration};
14-
use tokio::{fs, process::Command};
1514

1615
pub type DeviceId = u32;
1716
pub type NodeId = u32;
@@ -20,7 +19,6 @@ pub type RouteId = u32;
2019

2120
pub fn watch() -> impl Stream<Item = Message> + MaybeSend + 'static {
2221
async_fn_stream::fn_stream(|emitter| async move {
23-
fix_wireplumber_stream_properties().await;
2422
let (cancel_tx, mut cancel_rx) = futures::channel::oneshot::channel::<()>();
2523

2624
let (tx, pulse_rx) = futures::channel::mpsc::channel(1);
@@ -733,43 +731,3 @@ impl std::fmt::Debug for SubscriptionHandle {
733731
f.write_str("SubscriptionHandle")
734732
}
735733
}
736-
737-
async fn fix_wireplumber_stream_properties() {
738-
let home_dir = std::env::home_dir().expect("no home dir");
739-
let stream_properties_path = home_dir.join(".local/state/wireplumber/stream-properties");
740-
741-
let Ok(mut data) = fs::read_to_string(&stream_properties_path).await else {
742-
return;
743-
};
744-
745-
let mut insert_pos = 0;
746-
let mut lines = data.split('\n');
747-
while let Some(line) = lines.next() {
748-
if line.starts_with("Input/Audio:") {
749-
return;
750-
} else if line.starts_with("Output") {
751-
break;
752-
}
753-
754-
insert_pos += 1 + line.len();
755-
}
756-
757-
// Stop wireplumber
758-
_ = Command::new("systemctl")
759-
.args(["--user", "stop", "wireplumber"])
760-
.status()
761-
.await;
762-
763-
// Insert an Input/Audio property if none was found.
764-
data.insert_str(insert_pos, "Input/Audio:application.id:org.PulseAudio.pavucontrol={\"channelMap\":[\"MONO\"], \"mute\":false, \"volume\":1.000000, \"channelVolumes\":[1.000000]}\n");
765-
_ = fs::write(&stream_properties_path, &data).await;
766-
767-
// Then clear the cookie file to force it to be regenerated.
768-
_ = fs::remove_file(&home_dir.join(".config/pulse/cookie")).await;
769-
770-
// Restart wireplumber.
771-
_ = Command::new("systemctl")
772-
.args(["--user", "start", "wireplumber"])
773-
.status()
774-
.await;
775-
}

0 commit comments

Comments
 (0)