Skip to content

Commit 058524d

Browse files
committed
Extend the list of substrings to be searched for in the property list of libpulse active applications when searching for SongRec
1 parent 150eb14 commit 058524d

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/audio_controllers/pulseaudio.rs

+12-3
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,18 @@ impl PulseBackend {
3636

3737
let applications = self.handler.list_applications().unwrap();
3838

39-
for app in applications.clone() {
40-
if app.proplist.to_string().unwrap().to_lowercase().contains("songrec") {
41-
return Some(app.index);
39+
let criteria: Vec<String> = vec![
40+
format!("process.id = \"{}\"", std::process::id()),
41+
"alsa plug-in [songrec]".to_string(),
42+
"songrec".to_string(),
43+
format!("{}", std::process::id())
44+
];
45+
46+
for criterion in criteria {
47+
for app in applications.clone() {
48+
if app.proplist.to_string().unwrap().to_lowercase().contains(&criterion) {
49+
return Some(app.index);
50+
}
4251
}
4352
}
4453
None

0 commit comments

Comments
 (0)