apps/
apps.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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);

    // The following two methods are only available on macOS
    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);
}