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 also works realy great as an executable Scala script. It allows seamless integration into system configuration dotfiles.
For example the following Yabai
file is a standalone Scala program:
#!/usr/bin/env -S scala shebang -S 3 -j 23
//> using lib "lt.dvim.yabai::yabai-scala:2.0.1"
import lt.dvim.yabai.*
for {
_ <- (yabai.spaces.size until 10)
} yield yabai ! "space --create"
yabai window_gap 2
yabai window_shadow off
yabai padding 5
When run, it will create yabai spaces until the total number of spaces reaches 10. Also it will set window gap to 2, disable window shadows and set padding to 5.
The only system dependency is scala
itself, which can be installed with:
brew install scala
For a more complete example, check out full Yabai configuration.