#desktop-applications #installed #cross-platform #system #finding

bin+lib applications

A cross-platform library for finding installed applications

8 releases

0.2.3 Jun 19, 2024
0.2.2 Jun 12, 2024
0.2.1-alpha.2 May 29, 2024
0.2.0 Apr 23, 2024
0.1.1 Nov 20, 2023

#655 in Parser implementations

Download history 52/week @ 2024-07-08 4/week @ 2024-07-22 18/week @ 2024-08-12 14/week @ 2024-08-19 7/week @ 2024-08-26 16/week @ 2024-09-02 24/week @ 2024-09-09 1/week @ 2024-09-16 28/week @ 2024-09-23 18/week @ 2024-09-30 3/week @ 2024-10-07 21/week @ 2024-10-14

70 downloads per month

MIT license

70KB
1.5K SLoC

apps-rs

This crate is used to

  • get a list of installed applications on the system
  • get the frontmost application
  • get a list of running applications

Platforms

  • Mac
  • Linux
  • Windows

Usage

use applications::{AppInfoContext, AppInfo};

fn main() {
    let mut ctx = AppInfoContext::new();
    ctx.refresh_apps().unwrap(); // must refresh apps before getting them

    let apps = ctx.get_all_apps();
    println!("Apps: {:#?}", apps);

    let frontmost_app = ctx.get_frontmost_application().unwrap();
    println!("Frontmost App: {:#?}", frontmost_app);

    let running_apps = ctx.get_running_apps();
    println!("Running Apps: {:#?}", running_apps);
}

How?

How and where to search for available desktop applications on each platform?

Linux

Desktop applications are specified in files that ends with .desktop. echo $XDG_DATA_DIRS to see a list of paths where these desktop files could reside in.

The .desktop files are in toml format. Parse them with toml crate.

The Exec can be used to launch the app, and Icon field contains the app icon.

MacOS

The simplest way is to search in /Applications folder. The app icon is in .icns format. Apple silicon macs can now run iOS apps. iOS app icons are in .png format.

system_profiler command can be used to get installed applications.

system_profiler SPApplicationsDataType is the command to use to get a full list of applications.

Windows

https://crates.io/crates/winreg could be useful. Ask chatgpt for sample code.

Libraries

Dependencies

~5–17MB
~178K SLoC