Custom Modules
Right now, Scarlet lacks custom modules. This is a feature planned for version 1.0.
I have multiple implementations in mind for custom modules, notably:
- Lua modules
- Rust plugins
- Simple command line output modules
Lua modules
The first option is Lua modules. These would be written as Lua scripts that use some of the API exposed by Scarlet to display custom content.
The advantage with this approach is that modules would be fully customizable, down to the intricate details of how the widgets are configured. As Lua is a relatively easy language to write, this would make custom modules easy to create.
The main disadvantage is that this route requires a dependency on Lua and a bridge between Lua and Rust. mlua is the best crate for Lua-Rust interfacing, along with lgi, a Lua library that exposes an API for GObject based libraries.
Rust plugins
Using dlopen or libloading,
custom modules could be implemented as plugins. These plugins would be written in Rust
and loaded into the program dynamically, possibly adding a configuration option where
paths to .so libraries are listed.
The advantage is that it is possible to expose a Rust API using traits, though that may make it difficult to expose APIs for other languages.