Introduction

Statictranspl is a simple and static transpiler for ewwii. It is fast and is made for beginners who are unfamiliar with rhai syntax.

Statictranspl currently is very minimal and only supports basic transpilation of widgets only. Support for variables, functions, if/else, expressions, for/while, poll/listen etc. are still yet to be implmented.

One of the most useful features of statictranspl is its error handling. It is a better error handling than that of ewwii's, so some may find it easier to write configuration in statictranspl.

Installation

You can install statictranspl in 3 different ways. You can either download it from eiipm: ewwii's own package manager, build it from source, or install it with cargo.

It is suggested to install with eiipm as it is the package manager of ewwii, but other options work perfectly fine as well.

Installing via eiipm

# install statictranspl
eiipm install statictranspl

# run statictranspl
statictranspl --help

Installing via cargo

# install statictranspl
cargo install --git https://github.com/Ewwii-sh/statictranspl/

# run statictranspl
statictranspl --help

Compiling from source

# clone the repo with git
git clone https://github.com/Ewwii-sh/statictranspl.git

# go into the statictranspl directory
cd statictranspl

# build from source
cargo build --release

# run statictranspl
./target/release/statictranspl --help

Configuration

The main point of using statictranspl is for configuring ewwii. And this chapter goes into depth on how you can configure ewwii with stpl: statictranspl's configuration language.

Examples

Here is an example of a stpl bar that says "Hello World!":

widget "widget1" {
  box {
    class: "widget1"
    orientation: "h"
    space_evenly: true
    hexpand: true
    spacing: 5
  } {
      label {
        text: "Hello World!"
      }
  }
}

window "main_window" {
  monitor: 0
  windowtype: "dock"
  geometry: { x: "0" y: "0" width: "20px" height: "20px" }
} "widget1"

Transpiling

Once you have written your configuration in stpl, you can transpile it to rhai with the --transpile flag.

Usage example:

# long form
statictranspl --transpile ./path/to/file.stpl

# short form
statictranspl -t ./path/to/file.stpl

Other than providing just one stpl file, you can provide multiple stpl files as well! Just add them as well to the command.

Example:

# NOTE: you can also use the long form of `-t` which is `--transpile`
statictranspl -t ./path/to/file.stpl ./path/to/file2.stpl

The transpile command outputs the transpiled .rhai files in the current directory which the command is ran. If you want to specify a specific directory which you want the .rhai files to appear, then you can add the --out flag (or -o flag in short).

Example:

# long form
statictranspl -t ./path/to/file.stpl --out ./output_dir/

# short form
statictranspl -t ./path/to/file.stpl -o ./output_dir/

The transpiled code is unformatted by default and does not have whitespaces. Statictranspl provides a simple experimental formatter that follows the KISS (Keep It Simple Stupid) principle. You can make the transpiled code be formatted before writing by using the --format (or -f) flag.

Example:

# long form
statictranspl -t ./path/to/file.stpl -o ./output_dir/ --format

# short form
statictranspl -t ./path/to/file.stpl -o ./output_dir/ -f