Skip to main content

frontmost_application

Function frontmost_application 

Source
pub fn frontmost_application() -> Option<ForegroundApp>
Expand description

Return the currently frontmost application.

ForegroundApp::id defines the platform-specific identifier that per-app profiles match. ForegroundApp::display_name is the platform’s application name, falling back to the identifier.

None when no app is frontmost, when reading fails, or on an unsupported platform — including a pure-Wayland session with no backend (see linux::detect_frontmost_source). Costs one X11 round-trip on Linux and a handful of objc_msgSends on macOS. Callers can use watch_frontmost_application_changes to drive reads from native platform events instead of polling.