Yabai Scala is a DSL for Yabai configuration. This was started to help with creating missing workspaces. But eventually more useful features were implemented.
Yabai Scala can be used as a regular Scala library. However it works realy great with scala-cli. It allows seamless integration into system configuration dotfiles.
For example the following file:
//> using lib "lt.dvim.yabai::yabai-scala:2.0.1"
import lt.dvim.yabai.*
@main def run() =
for {
_ <- (yabai.spaces.max until 10)
} yield yabai ! "space --create"
is a standalone Scala program, which when run with scala-cli
will create
yabai spaces until the total number of spaces reaches 10:
~ ─╼ scala-cli run Yabai.scala
Compiling project (Scala 3.1.1, JVM)
Executing: yabai -m query --spaces
For a more complete example, check out full Yabai configuration.