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 GTK3 with an FLTK fallback. 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
- GTK3 primary backend on Linux with FLTK fallback
- 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: GTK3 (primary), with automatic fallback to fltk-rs if GTK fails to initialize
On Linux, pre-compiled FLTK binaries are bundled for common architectures (x64, arm64).
GTK3 development libraries are required at build time (libgtk-3-dev on Debian/Ubuntu).