xdialog
A cross-platform library for displaying native dialogs in Rust. On Windows and macOS, this library uses native system dialogs (Win32 TaskDialog and AppKit). On Linux, it uses FLTK by default, with optional GTK3 support. This allows for a simplified API and consistent behavior across platforms.
This is not a replacement for a proper GUI framework. It is meant to be used for CLI / background applications which occasionally need to show dialogs (such as alerts, or progress) to the user.
It's main use-case is for the Velopack application installation and update framework.
Features
- Cross-platform: works on Windows, macOS, and Linux
- Native backends on Windows (Win32) and macOS (AppKit) with zero additional build dependencies
- FLTK backend on Linux with optional GTK3 support
- Simple and consistent API across all platforms
Installation
Add the following to your Cargo.toml:
[]
= "0" # replace with the latest version
Or, run the following command:
Usage
Since some platforms require UI to be run on the main thread, xdialog expects to own the main thread, and will launch your core application logic in another thread.
use *;
There are more examples in the examples directory.
Backends
- Windows: Native Win32 TaskDialog API
- macOS: Native AppKit dialogs
- Linux: fltk-rs by default, with optional GTK3 support via the
gtkfeature
On Linux, pre-compiled FLTK binaries are bundled for common architectures (x64, arm64).
To enable GTK3 support, add the gtk feature to your dependency and install GTK3 development
libraries (libgtk-3-dev on Debian/Ubuntu). When the gtk feature is enabled, GTK3 becomes
the default backend, with automatic fallback to FLTK if GTK fails to initialize.
[]
= { = "0", = ["gtk"] }