//! Platform adapters behind one seam: `snapshot()` reads the running //! system, `install_watchers()` forwards real change events. use gpui::AsyncApp; use crate::ThemeVariant; use crate::system::SystemTheme; pub(crate) trait ThemeSource: 'static { fn snapshot(&self, variant: ThemeVariant) -> SystemTheme; fn install_watchers(&mut self, _async_cx: AsyncApp) {} fn label(&self) -> &'static str; } #[cfg(target_os = "macos")] pub(crate) fn platform_source() -> Box { Box::new(macos::MacosSource::default()) } #[cfg(target_os = "linux")] pub(crate) fn platform_source() -> Box { linux::platform_source() } #[cfg(target_os = "windows")] pub(crate) fn platform_source() -> Box { windows::platform_source() } #[cfg(not(any(target_os = "macos", target_os = "linux", target_os = "windows")))] pub(crate) fn platform_source() -> Box { Box::new(fallback::FallbackSource) } #[cfg(target_os = "macos")] pub(crate) mod macos; #[cfg(target_os = "linux")] pub(crate) mod linux; #[cfg(target_os = "windows")] pub(crate) mod windows; #[cfg(any(target_os = "linux", target_os = "windows"))] pub(crate) mod signal; #[cfg_attr(not(target_os = "linux"), allow(dead_code))] pub(crate) mod kde; #[cfg_attr(not(target_os = "linux"), allow(dead_code))] pub(crate) mod omarchy; #[cfg_attr(not(target_os = "linux"), allow(dead_code))] pub(crate) mod portal; pub(crate) mod fallback;