#native-dialog #dialog #file #path #desktop

native-dialog

A library to display dialogs. Supports GNU/Linux, BSD Unix, macOS and Windows.

40 releases

0.9.0 Apr 29, 2025
0.7.0 Oct 31, 2023
0.6.4 Jun 10, 2023
0.6.3 Jan 22, 2022
0.4.1 Jul 29, 2020

#24 in GUI

Download history 7683/week @ 2025-01-17 11103/week @ 2025-01-24 9580/week @ 2025-01-31 11686/week @ 2025-02-07 9085/week @ 2025-02-14 6715/week @ 2025-02-21 9289/week @ 2025-02-28 6734/week @ 2025-03-07 8332/week @ 2025-03-14 6463/week @ 2025-03-21 9581/week @ 2025-03-28 6885/week @ 2025-04-04 7707/week @ 2025-04-11 9247/week @ 2025-04-18 10645/week @ 2025-04-25 6878/week @ 2025-05-02

35,658 downloads per month
Used in 53 crates (46 directly)

MIT license

95KB
2.5K SLoC

native-dialog

Crates.io Docs.rs License

A library to display file choosers and message boxes. Supports GNU/Linux, BSD, macOS and Windows.

Installation

cargo add native-dialog

Usage

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;
}

Misc

Ugly or blurry dialogs on Windows

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.

Linux/BSD dependencies

The implementation for Linux and BSD requires either Zenity or Kdialog being installed; otherwise the MissingDep error will occur.

Dependencies

~0.4–13MB
~180K SLoC