Rust bindings for nativeapi — unified access to native system APIs: windows, tray icons, menus, displays, keyboard, dialogs, storage and more.
| Linux | macOS | Windows |
|---|---|---|
| ✅ | ✅ | ✅ |
🚧 Work in Progress: this crate is under active development.
cargo add nativeapiBuilding requires CMake and a C++17 compiler (the core library is compiled by build.rs). On Linux, also install:
sudo apt install libgtk-3-dev libx11-dev libxi-dev libayatana-appindicator3-devThe crate is split into nativeapi (safe API) and cnativeapi (raw FFI).
use nativeapi::DisplayManager;
fn main() {
for display in DisplayManager::get_all() {
let size = display.size();
println!("{}: {}x{}", display.name().unwrap_or_default(), size.width, size.height);
}
}See examples/. Each directory is a crate covering one module:
cargo run -p display_example
cargo run -p window_example
cargo run -p tray_icon_exampleshortcut_example and keyboard_example need accessibility permission on macOS — run accessibility_example first.
This repository is developed from the workspace, which checks out the core library, every binding and the code generator together:
git clone --recursive https://github.com/libnativeapi/workspace.gitFiles marked AUTO-GENERATED. DO NOT EDIT. are generated from the C++ headers in nativeapi. To change the API, send a pull request there; maintainers regenerate the bindings.
- API requests and native behavior bugs → nativeapi issues
- Bugs specific to one binding → that binding's repository
- Not sure → nativeapi issues
MIT