Skip to main content

Module detect

Module detect 

Source
Expand description

OS detection: dark mode, reduced motion, accessibility preferences, icon theme and set, desktop environment.

Structs§

DetectionContext
Process-wide detection cache.

Enums§

LinuxDesktop
Desktop environments recognized on Linux.

Functions§

accessibility_preferences
The OS accessibility preferences (cached): what AccessibilityPreferences::from_system reads, without running the platform reader again.
detect_icon_theme
Detect the icon theme name for the current platform without caching.
detect_is_dark
Detect whether the system is using a dark color scheme without caching.
detect_linux_desktop
Detect the current Linux desktop environment.
detect_reduced_motion
Detect whether the user prefers reduced motion without caching.
invalidate_caches
Reset all process-wide caches so the next call to system_is_dark(), prefers_reduced_motion(), accessibility_preferences(), or system_icon_theme() re-queries the OS; a cached failure to detect the icon theme is cleared too, and so, on Linux, is the detected desktop environment, with the desktop refined from it. The font DPI is not cached: since 0.7.1 it is a constant per platform, which ResolutionContext::from_system() uses.
parse_linux_desktop
Parse XDG_CURRENT_DESKTOP (a colon-separated list) and return the recognized desktop environment.
prefers_reduced_motion
Query whether the user prefers reduced motion.
system
Return the process-wide default DetectionContext.
system_icon_set
Detect the native icon set for the current operating system.
system_icon_theme
Detect the icon theme name for the current platform (cached).
system_is_dark
Detect whether the system is using a dark color scheme.