feat(audio): MPRIS Raise functionality
This commit is contained in:
parent
f0199dffe8
commit
3daffb4fba
2 changed files with 20 additions and 5 deletions
|
|
@ -603,6 +603,17 @@ impl cosmic::Application for Audio {
|
||||||
tracing::error!("Error playing previous: {}", err);
|
tracing::error!("Error playing previous: {}", err);
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
MprisRequest::Raise => tokio::spawn(async move {
|
||||||
|
let res = player.media_player().await;
|
||||||
|
if let Err(err) = res {
|
||||||
|
tracing::error!("Error fetching MediaPlayer: {}", err);
|
||||||
|
} else {
|
||||||
|
let res = res.unwrap().raise().await;
|
||||||
|
if let Err(err) = res {
|
||||||
|
tracing::error!("Error raising client: {}", err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
Message::OpenSettings => {
|
Message::OpenSettings => {
|
||||||
|
|
@ -945,10 +956,13 @@ impl cosmic::Application for Audio {
|
||||||
audio_content = audio_content
|
audio_content = audio_content
|
||||||
.push(padded_control(divider::horizontal::default()).padding([space_xxs, space_s]));
|
.push(padded_control(divider::horizontal::default()).padding([space_xxs, space_s]));
|
||||||
audio_content = audio_content.push(
|
audio_content = audio_content.push(
|
||||||
Row::with_children(elements)
|
menu_button(
|
||||||
.align_y(Alignment::Center)
|
Row::with_children(elements)
|
||||||
.spacing(8)
|
.align_y(Alignment::Center)
|
||||||
.padding(menu_control_padding()),
|
.spacing(8),
|
||||||
|
)
|
||||||
|
.on_press(Message::MprisRequest(MprisRequest::Raise))
|
||||||
|
.padding(menu_control_padding()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
let content = column![
|
let content = column![
|
||||||
|
|
|
||||||
|
|
@ -126,6 +126,7 @@ pub enum MprisRequest {
|
||||||
Pause,
|
Pause,
|
||||||
Next,
|
Next,
|
||||||
Previous,
|
Previous,
|
||||||
|
Raise,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct State {
|
struct State {
|
||||||
|
|
@ -282,7 +283,7 @@ async fn run(output: &mut futures::channel::mpsc::Sender<MprisUpdate>) {
|
||||||
_ = state.any_player_state_stream.next(), if !state.players.is_empty() => {
|
_ = state.any_player_state_stream.next(), if !state.players.is_empty() => {
|
||||||
state.update_active_player().await;
|
state.update_active_player().await;
|
||||||
},
|
},
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue