add windows theme source and platform icon resolvers

This commit is contained in:
2026-10-31 08:56:57 +07:00
parent c45f939211
commit d53f4e290d
13 changed files with 895 additions and 36 deletions
+38
View File
@@ -0,0 +1,38 @@
//! Wakes the main-thread resolve pipeline from watcher threads, which hold
//! no gpui context (the pinned gpui's `AsyncApp` is not `Send`).
use gpui::{AsyncApp, Task};
pub(crate) struct ReapplySignal {
sender: async_channel::Sender<()>,
_task: Task<()>,
}
impl ReapplySignal {
pub(crate) fn install(async_cx: &AsyncApp) -> Self {
let (sender, events) = async_channel::unbounded::<()>();
let task = async_cx.update(|cx| {
cx.spawn(async move |cx| {
while events.recv().await.is_ok() {
cx.update(crate::reapply);
}
})
});
Self {
sender,
_task: task,
}
}
/// A clone for a watcher thread to poke the pipeline with.
pub(crate) fn sender(&self) -> async_channel::Sender<()> {
self.sender.clone()
}
/// Pokes the pipeline from a thread holding a [`Self::sender`] clone.
pub(crate) fn poke(sender: &async_channel::Sender<()>) {
if let Err(error) = sender.try_send(()) {
eprintln!("theme: reapply signal failed: {error}");
}
}
}