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, the default backend is a pure Rust software renderer (winit + tiny-skia) with no C/C++ build dependencies, making it fully compatible with static musl builds. Optional GTK3 and FLTK backends are available via feature flags. 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
- Pure Rust software-rendered backend on Linux (no C/C++ dependencies, static musl compatible)
- Optional GTK3 and FLTK backends on Linux via feature flags
- Embedded font (Liberation Sans) - no system font dependencies on Linux
- 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 (default): Pure Rust software renderer using winit + tiny-skia + fontdue. No C/C++ build dependencies, works with static musl linking, and embeds its own font.
- Linux (
gtkfeature): GTK3 backend. Requireslibgtk-3-devon Debian/Ubuntu. When enabled, GTK3 becomes the default backend with automatic fallback to the software renderer if GTK fails to initialize. - Linux (
fltkfeature): fltk-rs backend. Requires cmake and X11/Wayland development libraries. Must be explicitly selected viaXDialogBuilder::new().with_backend(XDialogBackend::Fltk).
# Default (pure Rust, no extra dependencies)
[]
= "0"
# With GTK3 support
[]
= { = "0", = ["gtk"] }
# With FLTK support
[]
= { = "0", = ["fltk"] }