A Rust library for communicating with the yabai tiling window manager.
It sends client commands directly to the yabai server via UnixStream sockets, acting as a Rust equivalent of yabai -m
.
Add the following to your Cargo.toml
:
toml
[dependencies]
yabai = "0.1.0"
or using cargo add
:
sh
cargo add yabai
You can send commands in a yabai -m
-like fashion, using a string:
rust
yabai::send("--focus space 2");
Alternatively, you can use the Command
enum for more strongly-typed inputs:
```rust let command = yabai::Command::FocusSpace(yabai::SpaceOption::Recent);
yabai::send_command(command)?; ```
Displays, spaces, and windows can all be queried:
```rust
let displays = yabai::query_displays()?; // Vec
let spaces = yabai::query_spaces()?; // Vec
let windows = yabai::query_windows()?; // Vec