Skip to content

charlesbthomas/lattice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lattice

A tiling window manager for macOS, built in Rust. Uses vim-style modal keybindings (like tmux) and a 12x12 grid model for precise window placement.

Features

  • Modal keybindings — Leader key (Ctrl+Space) activates command mode, then single keys dispatch commands
  • 12x12 grid — Snap windows to presets (halves, thirds) or move/resize by grid units
  • Lua config — Customize everything in ~/.config/lattice/init.lua with hot-reload
  • Menu bar daemon — Runs as a background process with a status bar icon
  • macOS native — Uses Accessibility API and CGEventTap directly (no Electron, no SIP disable)

Requirements

  • macOS 13+
  • Rust 1.85+ (edition 2024)
  • Accessibility permission granted to the running terminal or binary

Install

git clone git@github.com:charlesbthomas/lattice.git
cd lattice
cargo build --release

The binary is at target/release/lattice.

Usage

# Run the daemon (menu bar icon appears)
lattice

# Or via just
just run

On first launch, macOS will prompt for Accessibility permission. Grant it to your terminal app (if using cargo run) or to the lattice binary directly.

Default Keybindings

Press Ctrl+Space to enter command mode, then:

Key Action
1 Left half
2 Right half
3 Left third
4 Center third
5 Right third
6 Left two-thirds
7 Right two-thirds
f Full screen
h/j/k/l Move window left/down/up/right by one grid unit
H/J/K/L Shrink/grow window
r Reload config
q Quit
Escape Cancel command mode

Command mode times out after 2 seconds of inactivity.

Configuration

Copy the default config and customize:

mkdir -p ~/.config/lattice
cp config/default.lua ~/.config/lattice/init.lua
lattice.grid { cols = 12, rows = 12 }
lattice.leader("ctrl+space")

lattice.bind("1", lattice.preset("left-half"))
lattice.bind("h", "move-left")
lattice.bind("H", "shrink-horizontal")

Changes are picked up automatically (hot-reload).

Architecture

crates/
  lattice-core/     Platform-agnostic grid, commands, input state machine
  lattice-macos/    AXUIElement wrappers, CGEventTap, window operations
  lattice-config/   Lua runtime (mlua/LuaJIT), config loading, file watcher
  lattice/          Binary: CLI, menu bar daemon, command dispatch

Development

Requires just.

just check    # fmt + check + clippy + test
just test     # run tests
just clippy   # lint
just fmt      # format
just build    # build debug
just run      # run daemon

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors