change to make playing players have priority always

This commit is contained in:
djaidjai committed 2025-05-01 01:09:24 +02:00
1 parent 809e51ae0f
commit 4f32cfd5ca
2 files changed
+4 -4

No files matched your search

+1 -1
View File
@@ -37,7 +37,7 @@ fn handle_signal(data: &Data) {
}
}
/// This function contains the default maim loop body of the program.
/// This function contains the default main loop body of the program.
/// It updates the active player, updates the output strings based on this, and finally formats and outputs these strings to stdout.
///
/// input:
+3 -3
View File
@@ -38,14 +38,14 @@ pub fn update_players(pf: &PlayerFinder, cfg: &Config, data: &mut Data) {
data.current_player = None;
debug!("update_players: no players found!")
} else {
let mut trees = vec![BTreeMap::new(), BTreeMap::new()];
let mut trees = vec![BTreeMap::new(), BTreeMap::new(), BTreeMap::new()];
for player in players {
if let Ok(status) = player.get_playback_status() {
let idx = cfg.find_player_priorities_idx(player.identity());
match status {
mpris::PlaybackStatus::Playing => trees[0].insert(idx, player),
mpris::PlaybackStatus::Paused => trees[0].insert(idx, player),
mpris::PlaybackStatus::Stopped => trees[1].insert(idx, player),
mpris::PlaybackStatus::Paused => trees[1].insert(idx, player),
mpris::PlaybackStatus::Stopped => trees[2].insert(idx, player),
};
}
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.