any-dialog
Simple desktop dialogs via whatever dialog tool the system already has.
any-dialog does not link a GUI toolkit. It drives an external helper
program instead, so it has zero dependencies and uses only the Rust
standard library.
Backends
Probed in order:
kdialog(Linux, common on KDE installs)zenity(Linux, common on GNOME installs)osascript(macOS, bundled with the OS)powershell(Windows, bundled with the OS)
On macOS and Windows the order flips: the OS's own bundled helper
(osascript or powershell) goes first there, since it is part of
the OS, with the other tools as fallbacks.
Version 1.0 is the first full release. Version 0.1.0 was published early to reserve the crate name.
If no helper is installed, calls return Error::NoBackend.
API documentation lives on docs.rs,
with runnable examples in this repository's examples/ directory.
The minimum supported Rust version is 1.85.
What it does
The prompt dialogs return Ok(None) when the user cancels:
prompt_text: ask for a line of text, with an optional initial valueprompt_password: ask for a password or other secret, masked while typedprompt_choice: ask the user to pick one item from a listprompt_choices: ask the user to pick any number of items from a listprompt_color: ask the user to pick a color, returned as#rrggbbprompt_open_file/prompt_open_files: pick one or several files to open, with optional named extension filtersprompt_save_file: pick a file to save to, with an optional suggested pathprompt_folder: pick a folderconfirm: ask a yes/no question, returning a boolshow_info,show_warning,show_error: show a message with a single dismiss button, at three levels of seriousness
Usage
use Dialogs;
Every call blocks until the user answers. Run calls on a worker thread, not on a UI or event-loop thread.
License
MIT. See LICENSE.