Native dialogs

From Rust Community Wiki
(Redirected from File dialogs)

Native dialogs are dialogs which can be created and used through APIs which are provided by the operating system. Some dialogs are modal and block all interaction with the parent window, and some are modeless and behave mostly like regular windows.

Some examples of native dialogs are:

  • File dialogs
  • The "about" dialog
  • Modal "confirmation" dialogs

There are a couple of crates which allow you to create different kinds of dialogs.

Pure Rust[edit]

Most of these crates can't implement all of their functionality in Rust since they have to call either OS-provided code on Windows and macOS, or use GTK/Qt or shell out to KDialog or Zenity on Linux. Despite this, we consider them "pure Rust" if they don't include a C "native dialog" library as a part of their build process.

Crate name Status (latest version) Development status (last updated) File dialog Message box Windows macOS Linux Notes
Cargo vec.svgdialog yes yes no no KDialog, Zenity Can also use the similarly named dialog tool to display a dialog via ncurses. Can also use the terminal directly in the absence of any external tools. You can either choose which tool to use (or not use any tool) or let the library choose for you.
Cargo vec.svgdialog-box yes yes no no Zenity Also supports a date picker and a message box with a text input.
Cargo vec.svgmsgbox no yes yes yes GTK Intentionally only exposes message boxes with a single "Ok" button.
Cargo vec.svgnative-dialog yes yes yes yes KDialog, Zenity Uses Cargo vec.svgwfd for file dialogs and Cargo vec.svgwinapi for message boxes on Windows. Uses Cargo vec.svgosascript on macOS.
Cargo vec.svgwfd yes no yes no no Calls Windows APIs through Cargo vec.svgwinapi .

Rust Wrappers[edit]

Crate name Status (latest version) Development status (last updated) File dialog Message box Windows macOS Linux Wraps Notes
Cargo vec.svgnfd yes no yes yes GTK nativefiledialog (C) nativefiledialog can optionally shell out to Zenity so that you can avoid depending on GTK, but nfd does not expose this option.
Cargo vec.svgnfd2 yes no yes yes GTK nativefiledialog (C) Fork of Cargo vec.svgnfd by Embark Studios, created due to concerns about a lack of bug-fixing from nfd's maintainer. The repository's README claims that they wish to eventually replace all C code with Rust.
Cargo vec.svgpicker yes unknown unknown yes unknown nativefiledialog (C) Despite being based on nativefiledialog, the README only claims support for macOS.
Cargo vec.svgtinyfiledialogs yes yes yes yes KDialog, Zenity tinyfiledialogs (C) Most downloaded crate by a wide margin as of July 2020 according to
Cargo vec.svgtauri-dialog no yes yes yes GTK Boxer (C++) Uses a forked version of Boxer, which is a C++ library. The forked version has changed the implementation language to C.