From e5da13b8cf2500671430968308339f0e73ffa7b4 Mon Sep 17 00:00:00 2001 From: a catgirl Date: Tue, 28 Jan 2025 17:11:11 -0500 Subject: [PATCH] fix: macos build, probably --- src/main.rs | 4 ++-- src/mpris_handler.rs | 15 +++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/main.rs b/src/main.rs index df0ae1f..2a025d9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -150,8 +150,8 @@ fn main() -> Result<(), Box> { // 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 { diff --git a/src/mpris_handler.rs b/src/mpris_handler.rs index 82e7588..8471d70 100644 --- a/src/mpris_handler.rs +++ b/src/mpris_handler.rs @@ -62,10 +62,13 @@ mod inner { self.controls.set_metadata(metadata).unwrap(); } - pub fn attach(&mut self, tx: super::Tx) -> Result<(), Box> { - 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(()) } } @@ -97,8 +100,8 @@ mod inner { #[inline] pub fn update(&mut self) { } - #[inline] pub fn attach(&mut self, _tx: Arc>) -> Result<(), Box> { - Err("Unsupported at compile time".into()) + #[inline] pub fn attach(&mut self, _tx: Arc>) -> Option<()> { + None } } } @@ -121,7 +124,7 @@ impl MediaInfo { self.inner.update(); } - pub fn attach(&mut self, tx: Tx) -> Result<(), Box> { + pub fn attach(&mut self, tx: Tx) -> Option<()> { self.inner.attach(tx) } }