Skip to content

Commit

Permalink
fix: macos build, probably
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamAnimate committed Jan 28, 2025
1 parent 20f6b98 commit e5da13b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {

// let has_dbus = media.attach(move |e| mpris_handler::on_media_event(e, mpris_mtx.clone()));
let has_dbus = media.attach(mpris_mtx);
if has_dbus.is_err() {
eprintln!("Disabling mpris due to lack of dbus... at least, presumably.\n{:?}", has_dbus.err());
if has_dbus.is_none() {
eprintln!("Disabling mpris due to lack of dbus...");
return;
}
loop {
Expand Down
15 changes: 9 additions & 6 deletions src/mpris_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,13 @@ mod inner {
self.controls.set_metadata(metadata).unwrap();
}

pub fn attach(&mut self, tx: super::Tx) -> Result<(), Box<dyn std::error::Error>> {
self.controls.attach(move |ev| on_media_event(ev, tx.clone()))?;
pub fn attach(&mut self, tx: super::Tx) -> Option<()> {
let attach = self.controls.attach(move |ev| on_media_event(ev, tx.clone()));
if attach.is_err() {
return None;
}

Ok(())
Some(())
}
}

Expand Down Expand Up @@ -97,8 +100,8 @@ mod inner {

#[inline] pub fn update(&mut self) { }

#[inline] pub fn attach(&mut self, _tx: Arc<mpsc::Sender<encore::SongControl>>) -> Result<(), Box<dyn std::error::Error>> {
Err("Unsupported at compile time".into())
#[inline] pub fn attach(&mut self, _tx: Arc<mpsc::Sender<encore::SongControl>>) -> Option<()> {
None
}
}
}
Expand All @@ -121,7 +124,7 @@ impl MediaInfo {
self.inner.update();
}

pub fn attach(&mut self, tx: Tx) -> Result<(), Box<dyn std::error::Error>> {
pub fn attach(&mut self, tx: Tx) -> Option<()> {
self.inner.attach(tx)
}
}
Expand Down

0 comments on commit e5da13b

Please sign in to comment.