Kael abstracts over macOS, Windows, Linux (X11 and Wayland), and FreeBSD through a single internalDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Augani/kael/llms.txt
Use this file to discover all available pages before exploring further.
Platform trait. You rarely implement this trait yourself, but you interact with the types it exposes — GpuSpecs, PowerMode, WindowAppearance, and related enums — whenever you need to adapt your application’s behavior to the host environment. This page documents all of those surface-level types and the patterns Kael uses to select the right backend at runtime.
GpuSpecs
GpuSpecs carries information about the GPU (or CPU-based software renderer) that Kael’s rendering backend is running on. You can retrieve it from a Window with window.gpu_specs().
rust
GpuSpecs derives Default, Debug, Clone, serde::Serialize, and serde::Deserialize.
true when Kael is rendering on a software GPU such as llvmpipe. This indicates the system has no discrete or integrated GPU, or that the platform fell back to a CPU renderer. You can use this flag to disable expensive visual effects that would be too slow on a software renderer.The human-readable name of the GPU device, as reported by Vulkan (or Direct3D on Windows). Examples:
"NVIDIA GeForce RTX 4090", "Apple M3 Pro", "llvmpipe (LLVM 17.0.6, 256 bits)".The name of the graphics driver. On Linux/Wayland and macOS this comes from the Blade renderer’s
device_information().driver_name. On Windows it is derived from the DXGI adapter’s VendorId.Further driver detail (e.g. a version string). On Windows this is the driver version formatted from the DXGI adapter description.
Retrieving GpuSpecs
rust
window.gpu_specs() returns Option<GpuSpecs>. On test platform targets it always returns None, so guard all uses with if let Some.PowerMode
PowerMode reflects the host operating system’s current power policy. Kael queries this through the Platform trait and exposes it on Window::power_mode().
rust
PowerMode derives Debug, Clone, Copy, PartialEq, Eq, and Default (Performance).
The system is plugged in or operating at full capacity. No frame-rate throttling is applied. This is the default.
The system is on battery but not in an aggressive power-save state. Kael may allow some background work to complete normally.
The OS low-power or battery-saver mode is active. Kael internally throttles frame scheduling to a maximum of roughly 30 fps (≈33 ms/frame) when
LowPower is active.Platform-specific detection
Each backend queries the OS power state natively:| Platform | Detection mechanism |
|---|---|
| macOS | NSProcessInfo.isLowPowerModeEnabled, NSProcessInfo.thermalState |
| Windows | PowerGetEffectiveOverlayScheme via WinAPI |
| Linux | /sys/class/power_supply or D-Bus upower |
Reacting to power changes
TheSystemPowerEvent::PowerModeChanged event fires whenever the OS power policy changes. Subscribe to it through the Platform trait’s event callback to update your application behavior dynamically:
rust
WindowAppearance
WindowAppearance describes the OS-level light/dark appearance assigned to a window. Kael surfaces it via Window::appearance() and Platform::window_appearance().
rust
WindowAppearance derives Copy, Clone, Debug, Default, PartialEq, and Eq.
Standard light mode. The default on all platforms. On macOS this corresponds to the
aqua NSAppearance.Light mode with translucency effects. macOS only (
NSAppearanceNameVibrantLight). On other platforms Kael maps this to Light.Standard dark mode. On macOS this corresponds to the
darkAqua NSAppearance.Dark mode with translucency effects. macOS only (
NSAppearanceNameVibrantDark). On other platforms Kael maps this to Dark.Using WindowAppearance with themes
The most common use ofWindowAppearance is selecting the right theme at window creation:
rust
Theme::for_appearance internally matches on WindowAppearance:
rust
PreferDark → Dark, everything else → Light). On Windows, Kael reads the registry key for the system dark mode flag.
The Platform trait
Platform is an internal trait (pub(crate)) that each backend implements. You interact with it indirectly through App and Window methods, but the trait’s shape is useful to understand:
rust
Backend selection
Kael picks a backend at startup based on the compile target and environment variables:Compositor detection on Linux
guess_compositor() checks environment variables to decide which Wayland or X11 backend to use:
rust
guess_compositor does not attempt to connect to the compositor — it only reads environment variables. A connection failure will be reported later when the backend client initializes.Related platform enums
SystemPowerEvent
Fired when significant OS power state transitions occur.rust
WindowBackgroundAppearance
Controls the visual treatment of the window background when no content is present.rust
PowerSaveBlockerKind
Passed to the platform’s power-save-blocker API to prevent the system from suspending or the display from sleeping.rust