File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -1997,7 +1997,7 @@ async fn main() {
1997
1997
}
1998
1998
1999
1999
#[ cfg( feature = "with-mpris" ) ]
2000
- let mpris = MprisEventHandler :: spawn ( player. clone ( ) )
2000
+ let mpris = MprisEventHandler :: spawn ( player. clone ( ) , & setup . connect_config . name )
2001
2001
. await
2002
2002
. unwrap_or_else ( |e| {
2003
2003
error ! ( "could not initialize MPRIS: {e}" ) ;
Original file line number Diff line number Diff line change @@ -150,7 +150,9 @@ type Volume = f64;
150
150
// Time in microseconds.
151
151
type TimeInUs = i64 ;
152
152
153
- struct MprisService { }
153
+ struct MprisService {
154
+ identity : String ,
155
+ }
154
156
155
157
#[ zbus:: interface( name = "org.mpris.MediaPlayer2" ) ]
156
158
impl MprisService {
@@ -259,8 +261,7 @@ impl MprisService {
259
261
#[ zbus( property) ]
260
262
async fn identity ( & self ) -> String {
261
263
debug ! ( "org.mpris.MediaPlayer2::Identity" ) ;
262
- // TOOD: use name from config
263
- "Librespot" . to_owned ( )
264
+ self . identity . clone ( )
264
265
}
265
266
266
267
// The basename of an installed .desktop file which complies with the
@@ -831,10 +832,12 @@ pub struct MprisEventHandler {
831
832
}
832
833
833
834
impl MprisEventHandler {
834
- pub async fn spawn ( player : Arc < Player > ) -> Result < MprisEventHandler , MprisError > {
835
+ pub async fn spawn ( player : Arc < Player > , name : & str ) -> Result < MprisEventHandler , MprisError > {
835
836
let ( cmd_tx, cmd_rx) = mpsc:: unbounded_channel ( ) ;
836
837
837
- let mpris_service = MprisService { } ;
838
+ let mpris_service = MprisService {
839
+ identity : name. to_string ( ) ,
840
+ } ;
838
841
let mpris_player_service = MprisPlayerService {
839
842
spirc : None ,
840
843
// FIXME: obtain current values from Player
You can’t perform that action at this time.
0 commit comments