Crates.io | applications |
lib.rs | applications |
version | 0.2.3 |
source | src |
created_at | 2023-11-18 19:21:54.478997 |
updated_at | 2024-06-19 04:29:57.910295 |
description | A cross-platform library for finding installed applications. |
homepage | |
repository | https://github.com/HuakunShen/applications-rs/ |
max_upload_size | |
id | 1040679 |
size | 178,189 |
This crate is used to
- get a list of installed applications on the system
- get the frontmost application
- get a list of running applications
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 and where to search for available desktop applications on each platform?
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.
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.
https://crates.io/crates/winreg could be useful. Ask chatgpt for sample code.