#window-manager #tiling #communicating #command #api-bindings #ipc #sockets

yabai

A crate for communicating with the yabai tiling window manager

4 releases (breaking)

0.5.0 Mar 31, 2024
0.4.0 Dec 23, 2023
0.2.0 Apr 11, 2023
0.1.0 Apr 8, 2023

#360 in GUI

Download history 30/week @ 2024-02-26 3/week @ 2024-03-11 94/week @ 2024-03-25 108/week @ 2024-04-01

205 downloads per month

MIT license

13KB
232 lines

yabai.rs

A Rust library for communicating with the yabai tiling window manager's ipc socket, acting as a Rust equivalent of the yabai -m command.

Installation

Add the following to your Cargo.toml:

[dependencies]
yabai = "0.5.0"

or using cargo add:

cargo add yabai

Sending Commands

You can send commands in a yabai -m like fashion, using a string:

yabai::send("--focus space 2");

Alternatively, you can use the Command enum for more strongly-typed inputs:

let command = yabai::Command::FocusSpace { option: yabai::SpaceOption::Recent };

yabai::send_command(command)?;

Queries

Displays, spaces, and windows can all be queried:

let displays = yabai::query_displays()?; // Vec<DisplayInfo>

let spaces = yabai::query_spaces()?; // Vec<SpaceInfo>

let windows = yabai::query_windows()?; // Vec<WindowInfo>

Cargo Features

  • "python" - Adds pyo3 derive attributes to yabai command enums.

Dependencies

~1–8.5MB
~51K SLoC