app-info 0.1.1

Get the installed apps and icons on the device
Documentation

app-info

app-info is a synchronous Rust library for discovering installed desktop applications and extracting file icons on macOS and Windows.

Features

  • Enumerates application metadata without loading icons by default.
  • Loads icons lazily or during enumeration at a requested size.
  • Returns tightly packed RGBA pixels with cheap, reference-counted clones.
  • Supports best-effort scans with per-entry warnings and strict scans that stop at the first error.
  • Scans standard macOS application roots recursively.
  • Scans per-machine and per-user Windows uninstall registry views.
  • Supports optional Serde serialization through the serde feature.

Installation

[dependencies]
app-info = "0.1"

Enable serialization only when it is needed:

[dependencies]
app-info = { version = "0.1", features = ["serde"] }

Fast metadata-only listing

use app_info::get_installed_apps;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    for app in get_installed_apps(0)? {
        println!("{}: {}", app.name, app.path.display());
    }
    Ok(())
}

Passing 0 keeps enumeration inexpensive because no pixel buffers are created.

Listing with diagnostics

use app_info::{get_installed_apps_with_options, ListOptions};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let options = ListOptions::new().with_icon_size(64)?;
    let report = get_installed_apps_with_options(options)?;

    println!("found {} applications", report.apps.len());
    for warning in report.warnings {
        eprintln!("warning: {}", warning.message);
    }
    Ok(())
}

Use ListOptions::new().strict(true) when inaccessible or malformed entries should fail the complete operation.

Lazy icon loading

use app_info::{find_app_by_name, get_file_icon};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let app = find_app_by_name("Calculator", 0)?;
    let icon = get_file_icon(&app.path, 128)?;
    println!("{}x{}, {} RGBA bytes", icon.width, icon.height, icon.pixels.len());
    Ok(())
}

Icon edges must be between 1 and MAX_ICON_SIZE (currently 2048). This prevents accidental multi-gigabyte allocations.

Name and identifier lookup

  • find_apps_by_name returns every matching display name.
  • find_app_by_name is the compatibility helper that returns the first match.
  • find_app_by_identifier uses the macOS bundle identifier or Windows product code when available.

Saving icons

The example writes application icons to collision-safe PNG filenames:

cargo run --example save_icon

Platform behavior

macOS

The library recursively scans /Applications, /System/Applications, and the current user's ~/Applications directory. Icons are rendered through AppKit in an autorelease pool, with the calling thread's graphics context restored before returning.

Windows

The library scans the Uninstall registry keys under HKEY_LOCAL_MACHINE and HKEY_CURRENT_USER, including 32-bit and 64-bit views on 64-bit builds. It filters common system/update entries, expands environment variables, handles quoted DisplayIcon values and converts Shell icons to RGBA through WIC.

Known limitations

  • Applications installed outside the standard macOS roots are not discovered.
  • Microsoft Store/MSIX packages that do not publish uninstall registry entries are not currently enumerated.
  • Publisher and installation date availability varies by platform and installer.
  • Some applications do not expose a usable icon or executable path.
  • The API is synchronous; call it from a worker thread in latency-sensitive UI applications.

License

MIT