1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-08-17 14:51:04 +02:00

refactor: overhaul .desktop and image resolver systems

Rewrites the desktop file parser code and image resolver code to introduce caching system and make fully async. They should be much faster now.

BREAKING CHANGE: The `icon_theme` setting has been moved from per-bar to top-level
This commit is contained in:
Jake Stanger 2025-05-25 15:50:21 +01:00
parent ca524f19f6
commit 3e55d87c3a
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61
26 changed files with 1840 additions and 600 deletions

View file

@ -125,6 +125,12 @@ where
fn recv_glib<F>(self, f: F)
where
F: FnMut(T) + 'static;
/// Like [`BroadcastReceiverExt::recv_glib`], but the closure must return a [`Future`].
fn recv_glib_async<Fn, F>(self, f: Fn)
where
Fn: FnMut(T) -> F + 'static,
F: Future;
}
impl<T> BroadcastReceiverExt<T> for broadcast::Receiver<T>
@ -152,4 +158,29 @@ where
}
});
}
fn recv_glib_async<Fn, F>(mut self, mut f: Fn)
where
Fn: FnMut(T) -> F + 'static,
F: Future,
{
glib::spawn_future_local(async move {
loop {
match self.recv().await {
Ok(val) => {
f(val).await;
}
Err(broadcast::error::RecvError::Lagged(count)) => {
tracing::warn!(
"Channel lagged behind by {count}, this may result in unexpected or broken behaviour"
);
}
Err(err) => {
tracing::error!("{err:?}");
break;
}
}
}
});
}
}