Skip to content

Commit 6b8d3dc

Browse files
wiiznokesmmstick
authored andcommitted
improv: filter firefox player
1 parent c8d91a8 commit 6b8d3dc

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

cosmic-applet-audio/src/mpris_subscription.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,15 @@ struct State {
135135
any_player_state_stream: futures::stream::SelectAll<zbus::PropertyStream<'static, String>>,
136136
}
137137

138+
fn filter_firefox_players(players: &mut Vec<MprisPlayer>) {
139+
if players
140+
.iter()
141+
.any(|e| e.name() == "org.mpris.MediaPlayer2.plasma-browser-integration")
142+
{
143+
players.retain(|e| !e.name().starts_with("org.mpris.MediaPlayer2.firefox."));
144+
}
145+
}
146+
138147
impl State {
139148
async fn new() -> Result<Self, zbus::Error> {
140149
let conn = Connection::session().await?;
@@ -154,6 +163,7 @@ impl State {
154163
}
155164
}
156165
}
166+
filter_firefox_players(&mut players);
157167

158168
// pre-sort by path so that the same player is always selected
159169
players.sort_by(|a, b| a.name().cmp(&b.name()));
@@ -180,6 +190,7 @@ impl State {
180190
}
181191
};
182192
self.players.push(player);
193+
filter_firefox_players(&mut self.players);
183194
self.players.sort_by(|a, b| a.name().cmp(&b.name()));
184195
self.update_any_player_state_stream().await;
185196
}

0 commit comments

Comments
 (0)