From 48d6af0281f460d3ed3745a2ffb2b61848430ecb Mon Sep 17 00:00:00 2001 From: Jake Stanger Date: Sun, 21 May 2023 20:44:31 +0100 Subject: [PATCH] fix(music): showing when no mpris player found THe music module expects an event to be sent on subscription to the client to set up the initial state. This ensures an event is sent when in MPRIS mode when no player is initially found. --- src/clients/music/mpris.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/clients/music/mpris.rs b/src/clients/music/mpris.rs index 289ffc7..e99556e 100644 --- a/src/clients/music/mpris.rs +++ b/src/clients/music/mpris.rs @@ -231,6 +231,16 @@ impl MusicClient for Client { if let Err(err) = Self::send_update(&player, &self.tx) { error!("{err:?}"); } + } else { + let status = Status { + playlist_position: 0, + playlist_length: 0, + state: PlayerState::Stopped, + elapsed: None, + duration: None, + volume_percent: 0, + }; + send!(self.tx, PlayerUpdate::Update(Box::new(None), status)); } rx