AprilNEA/appcatalog

★ 1Forks 0RustGitHub ↗Compare

README

appcatalog

Cross-platform discovery and identity for desktop applications.

appcatalog exposes two deliberately separate concepts:

  • applications registered with the operating system;
  • the application that owns the foreground window right now.

It preserves native identity namespaces instead of matching localized names: macOS bundle identifiers, Windows executable paths, X11 WM_CLASS, and Wayland application IDs.

let applications = appcatalog::applications()?;
if let Some(foreground) = appcatalog::foreground_application()? {
    if let Some(application) = applications
        .iter()
        .find(|application| application.matches(&foreground))
    {
        println!("{} is in front", application.name);
    }
}
# Ok::<(), appcatalog::Error>(())

Platform scope

Catalog discovery means applications registered with the desktop environment. Portable executables, AppImages, or unregistered bundles may not appear.

Platform Catalog identity Foreground identity
macOS bundle identifier bundle identifier
Linux/X11 desktop ID + StartupWMClass WM_CLASS
Linux/wlroots Wayland desktop ID + Wayland IDs compositor app ID
Windows executable path + file name executable path + file name

Icon metadata is returned lazily as a file, theme name, or platform resource. application_icon renders an identity's icon at a requested pixel size into straight-alpha RGBA8 pixels, ready for a GPU texture or an image encoder (macOS today; the Linux and Windows backends report no icon yet). The library has no GUI or async-runtime dependency.

Known limits

  • macOS discovery scans the standard system, network, and per-user application directories. Bundles registered from custom locations or external volumes may not appear.
  • Native Wayland foreground observation requires the wlr-foreign-toplevel-management protocol (sway, Hyprland, river, and other wlroots compositors). GNOME and KDE expose no stable, general-purpose API for the active native window; XWayland windows still use the X11 fallback.
  • Windows discovery currently covers classic per-user and common Start Menu shortcuts. Packaged/UWP AppsFolder registrations are not yet enumerated.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Contributors

AprilNEA

Issues