A (very) basic Cross-platform GUI Toolkit for Any Language
Modulo is a simple, distributable binary that can be used to generate a variety of native GUI dialogs with ease:
macOS | Linux | Windows |
---|---|---|
modulo is still in its early days, so some of the details are work in progress.
If you use modulo as part of espanso, it's shipped by default with it since version 0.7.0.
For Windows x64 systems, you can find the prebuilt modulo-win.exe
in the Releases page.
While you can simply download it in your favourite location, if you use modulo as part of espanso you should:
- Rename the executable from
modulo-win.exe
tomodulo.exe
- Move it to a persistent location, such as
C:\modulo\modulo.exe
- Add that location (
C:\modulo
) to the PATH environment variable.
modulo also requires Visual C++ Redistributable 2019 to run.
To compile modulo on Windows, you need a recend Rust compiler, the MSVC C++ compiler and the LLVM compiler.
TODO
If you use modulo as part of espanso and used Homebrew to install it, modulo is automatically included since version 0.7.0.
For x64 macOS systems, you can find the prebuilt modulo-mac
in the Releases page.
While you can simply download it in your favourite location, if you use modulo as part of espanso you should:
- Rename the executable from
modulo-mac
tomodulo
- Place it in
/usr/local/bin
Compiling from source on macOS requires a few steps:
- Download the wxWidgets source archive
- Extract the content of the archive in a known directory, such as
$USER/wxWidgets
. - Open a terminal, cd into the wxWidgets directory and type the follwing commands:
mkdir build-cocoa
cd build-cocoa
../configure --disable-shared --enable-macosx_arch=x86_64
make -j6
-
Install LLVM using Homebrew with:
brew install llvm
-
Now open the
modulo
project directory in the Terminal and compile with:WXMAC=$USER/wxWidgets cargo build --release
-
You will find the compiled binary in the
target/release
directory.
On Linux the easiest way to use modulo is the offical AppImage, that you can find in the Releases page.
Compiling modulo is not too difficult, but requires many tools so it's highly suggested to use the AppImage instead. If you still want to compile it:
-
Install the wxWidgets development packages for you platform, the Clang compiler and the Rust compiler. On Ubuntu/Debian, they can be installed with:
sudo apt install clang libwxgtk3.0-0v5 libwxgtk3.0-dev build-essential
. -
In the project directory run:
cargo build --release
. -
You will find the compiled binary in the
target/release
directory.
There are a variety of built-in dialogs that can be customized by feeding modulo with YAML (or JSON) descriptors:
- Create a
form.yml
file with the following content:
layout: |
Hey {{name}},
This form is built with modulo!
- Invoke
modulo
with the command:
modulo form -i form.yml
- The dialog will appear:
- After clicking on
Submit
(or pressing CTRL+Enter), modulo will return to theSTDOUT
the values as JSON:
{"name":"John"}
This was a very simple example to get you started, but its only the tip of the iceberg!
Modulo is written in Rust and uses the wxWidgets GUI toolkit under the hoods. This allows modulo to use platform-specific controls that feel, look and behave much better than other solutions based on emulation (such as web-based technologies as Electron), with the additional benefit of a very small final size.
More info coming soon...