Compare commits

...

2 commits

Author SHA1 Message Date
932471218a some mpris work 2024-11-16 14:42:39 +01:00
1757e64961 make sure playbar center is centered 2024-11-16 14:42:39 +01:00
2 changed files with 29 additions and 12 deletions

View file

@ -21,7 +21,7 @@ template $AudreyUiPlaybar: Adw.Bin {
]
[start]
Box {
Box start {
AspectFrame {
visible: false; // FIXME annoying annoying annoying annoying
// visible: bind template.show_cover_art;
@ -156,7 +156,7 @@ template $AudreyUiPlaybar: Adw.Bin {
}
[end]
Box {
Box end {
Button {
icon-name: "heart-empty-symbolic"; // placeholder
valign: center;
@ -184,3 +184,9 @@ template $AudreyUiPlaybar: Adw.Bin {
};
};
}
// make sure the middle is centered always
SizeGroup {
mode: horizontal;
widgets [start, end]
}

View file

@ -242,35 +242,46 @@ impl Player {
#[zbus::interface(name = "org.mpris.MediaPlayer2.Player")]
impl Player {
fn next(&self) -> zbus::fdo::Result<()> {
Err(zbus::fdo::Error::NotSupported("not implemented".into()))
self.window().playlist_next();
Ok(())
}
fn previous(&self) -> zbus::fdo::Result<()> {
Err(zbus::fdo::Error::NotSupported("not implemented".into()))
self.window().playlist_prev();
Ok(())
}
fn pause(&self) -> zbus::fdo::Result<()> {
Err(zbus::fdo::Error::NotSupported("not implemented".into()))
self.window().set_pause(true);
Ok(())
}
fn play_pause(&self) -> zbus::fdo::Result<()> {
Err(zbus::fdo::Error::NotSupported("not implemented".into()))
self.window().set_pause(!self.window().pause());
Ok(())
}
fn stop(&self) -> zbus::fdo::Result<()> {
Err(zbus::fdo::Error::NotSupported("not implemented".into()))
self.window().set_pause(true);
self.window().set_time_pos(0.0);
Ok(())
}
fn play(&self) -> zbus::fdo::Result<()> {
Err(zbus::fdo::Error::NotSupported("not implemented".into()))
self.window().set_pause(false);
Ok(())
}
fn seek(&self, _offset: i64) -> zbus::fdo::Result<()> {
Err(zbus::fdo::Error::NotSupported("not implemented".into()))
fn seek(&self, offset: i64) -> zbus::fdo::Result<()> {
self.window().seek(offset as f64 / MICROSECONDS);
Ok(())
}
fn set_position(&self, _track_id: ObjectPath<'_>, _position: i64) -> zbus::fdo::Result<()> {
Err(zbus::fdo::Error::NotSupported("not implemented".into()))
fn set_position(&self, track_id: ObjectPath<'_>, position: i64) -> zbus::fdo::Result<()> {
if Some(track_id) == self.metadata.track_id.as_ref().map(|x| x.as_ref()) {
self.window().set_time_pos(position as f64 / MICROSECONDS);
}
Ok(())
}
fn open_uri(&self, _s: String) -> zbus::fdo::Result<()> {