| Crates.io | native-dialog |
| lib.rs | native-dialog |
| version | 0.9.0 |
| created_at | 2020-06-12 22:38:31.259025+00 |
| updated_at | 2025-04-29 07:29:59.679453+00 |
| description | A library to display dialogs. Supports GNU/Linux, BSD Unix, macOS and Windows. |
| homepage | |
| repository | https://github.com/balthild/native-dialog-rs |
| max_upload_size | |
| id | 253435 |
| size | 114,579 |
A library to display file choosers and message boxes. Supports GNU/Linux, BSD, macOS and Windows.
cargo add native-dialog
use native_dialog::{DialogBuilder, MessageLevel};
let path = DialogBuilder::file()
.set_location("~/Desktop")
.add_filter("PNG Image", &["png"])
.add_filter("JPEG Image", &["jpg", "jpeg"])
.open_single_file()
.show()
.unwrap();
let path = match path {
Some(path) => path,
None => return,
};
// Asyncronous Dialog
let yes = DialogBuilder::message()
.set_level(MessageLevel::Info)
.set_title("Do you want to open the file?")
.set_text(format!("{:#?}", path))
.confirm()
.spawn()
.await
.unwrap();
if yes {
do_something(path).await;
}
Turn on crate features or embed manifests into the .exe to enable visual styling and dpi awareness for your program. Check out examples/windows_manifest and examples/windows_features for example.
The implementation for Linux and BSD requires either Zenity or Kdialog being installed; otherwise the MissingDep error will occur.