Developer Guide
This guide is the canonical narrative reference for flow. It explains why
the system is shaped the way it is, how the pieces fit together, and where
to look in the source for each concern.
Suggested Reading Order
If you haven’t built FlowWM yet, start with Building from Source.
- Architecture — the subsystem map and the single-orchestrator model. Start here.
- Threading Model — why
flowuses noArc<Mutex>and how the hook thread talks to the IPC thread. - Event Pipelines — the two flows that drive every layout change: Win32 hooks and IPC commands.
- Layout Overview — the infinite canvas, the
camera model, and the Virtual → Actual split. The heart of
flow. - Mutation Pipeline — how every command flows
through
mutate → project → animate. - The rest in any order: Workspace, Window Registry, Animation, IPC & Watchdog, Config & Persistence.
Reference
- Design Decisions — consolidated “why not X” trade-offs (single package, pixel widths, TOML, etc.).
- Roadmap — what’s implemented, what’s stubbed, what’s next.
Repository Layout
flow/
├── Cargo.toml
├── build.rs
├── default-config.toml # hand-written EXAMPLE (not read at runtime)
├── default-flow-rules.toml # bundled default window rules (include_str!)
├── docs/ # this mdBook
├── schemas/ # generated JSON schemas for config/rules
├── src/
│ ├── main.rs # flowd entry point
│ ├── lib.rs # shared library
│ ├── bin/
│ │ └── flow.rs # CLI client
│ ├── common/ # shared types: Rect, WindowId, Direction, errors
│ ├── config/ # TOML loading, schema gen, dirs, lifecycle
│ ├── registry/ # WindowRegistry: OS sync, classification, hooks
│ ├── layout/ # PURE layout math: types, mutations, projection
│ ├── workspace/ # Monitor → Workspace → Scrolling/Floating spaces
│ ├── animation/ # embedded window-animation crate
│ ├── ipc/ # named-pipe transport + SocketMessage types
│ └── daemon/ # FlowWM orchestrator + submodules
└── tests/ # integration tests
The two big ideas to internalise before reading any source file:
- The layout pipeline is pure.
src/layout/has zero Win32 dependencies and is fully unit-testable on any platform.src/workspace/scrolling_space.rsorchestratesmutate → project → animateand is the only thing that touches all three layers. - The daemon is the single coordinator.
FlowWMowns every subsystem and routes events between them. No subsystem knows about any other subsystem — they only expose methods that take inputs and return outputs.