Skip to content

Commit

Permalink
Extend the list of substrings to be searched for in the property list…
Browse files Browse the repository at this point in the history
… of libpulse active applications when searching for SongRec
  • Loading branch information
marin-m committed Jan 22, 2024
1 parent 150eb14 commit 058524d
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/audio_controllers/pulseaudio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,18 @@ impl PulseBackend {

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

for app in applications.clone() {
if app.proplist.to_string().unwrap().to_lowercase().contains("songrec") {
return Some(app.index);
let criteria: Vec<String> = vec![
format!("process.id = \"{}\"", std::process::id()),
"alsa plug-in [songrec]".to_string(),
"songrec".to_string(),
format!("{}", std::process::id())
];

for criterion in criteria {
for app in applications.clone() {
if app.proplist.to_string().unwrap().to_lowercase().contains(&criterion) {
return Some(app.index);
}
}
}
None
Expand Down

0 comments on commit 058524d

Please sign in to comment.