Skip to main content

rio_window/platform/
linux.rs

1#[cfg(any(x11_platform, wayland_platform))]
2use crate::event_loop::ActiveEventLoop;
3
4#[cfg(any(x11_platform, wayland_platform))]
5pub trait ActiveEventLoopExtLinux {
6    /// Start following the system color-scheme (dark/light) via the XDG Desktop
7    /// Portal.
8    ///
9    /// While active, the event loop reports the current preference through
10    /// [`ActiveEventLoop::system_theme`] and emits
11    /// [`WindowEvent::ThemeChanged`](crate::event::WindowEvent::ThemeChanged) for
12    /// every window whenever it changes.
13    ///
14    /// Call this once, only when the application wants to follow the system
15    /// theme; the watcher then runs for the lifetime of the process.
16    fn start_system_theme_monitor(&self);
17}
18
19#[cfg(any(x11_platform, wayland_platform))]
20impl ActiveEventLoopExtLinux for ActiveEventLoop {
21    #[inline]
22    fn start_system_theme_monitor(&self) {
23        self.p.start_system_theme_monitor();
24    }
25}