Skip to main content

Nim Native Dialogs Package v.0.1


With this short post I'd like to introduce you my small Nim language package called native_dialogs which is intended to implement framework-agnostic way to call underlying operating system file save/open/etc. dialogues.
From my experience it is always quite a pain for cross-platform GUI development to implement file dialogues, and both approaches: native and custom dialogues are used from framework to framework. Anyway, this small lib allows you to use file dialogues with a GUI framework of your choice as simple as withing small command-line applications or automation scripts.

You can easily install the package using nimble package manager:
$ nimble install native_dialogs
The API is pretty simple, and it looks like that code below:
import native_dialogs

echo callDialogFileOpen("Open File")
echo callDialogFileSave("Save File")
echo callDialogFolderCreate("Create New Folder")
echo callDialogFolderSelect("Open Folder")
For now (version 0.1) only single-file dialogues are implemented, which is still very useful at least for our development team.

Here's a screenshot of how does callDialogFileOpen(...)  result looks like on the latest Ubuntu:

Ubuntu Open File Dialog Called With `native_dialogs` library
Ubuntu Open File Dialog Called With `native_dialogs` library

The library provides single API for popular desktop platforms:
  • OS X w/ Cocoa
  • GNU/Linux w/ GTK+3
  • Windows w/ Win32 API

Each of these functions currently returns a string with a full path to the selected object (file or directory). Hope someone finds the package helpful, and the contribution is always welcomed ;)

Comments