How glzr-io/glazewm works
Project type and purpose
• GlazeWM is an open-source, Rust-based tiling window manager for Windows, inspired by i3wm.
• It’s a CLI-driven application that runs as a background service, intercepts OS window events, applies user commands (via keybindings or CLI), and manages window layouts.
File structure
• Top-level Cargo workspace:
• Cargo.toml, rust-toolchain.toml, rustfmt.toml
• Crates under packages/:
• wm: core WM engine and IPC server
• wm-cli: command-line interface client
• wm-common: shared DTOs, types, utility functions
• wm-ipc-client: library for talking to wm’s IPC server
• wm-platform: platform abstraction (Win32/COM hooks, event listeners)
• wm-watcher: helper that watches for new processes/windows
• CI/CD: GitHub workflows for lint, package, release
Extract insights from README
• Describes user flow:
• Start GlazeWM (via installer or CLI)
• Load YAML config
• Spawn background process (wm)
• Intercept OS events, run user commands, update layout
• Optional: UI integration with Zebar via IPC
• Key technologies:
• Rust/Cargo workspace
• Win32 hooks & COM (in wm-platform)
• Local IPC (likely named pipes or sockets)
• YAML configuration file
• WiX installer
Main components and their relationships
A. Core WM Engine (wm crate)
• Events In: OS window events (create, destroy, move, focus, etc.)
• Commands In: IPC messages from CLI or scripts
• Logic: manages tiling tree, workspaces, layout, window states
• Outputs: OS calls (move/resize windows), send events back via IPC
B. Platform Abstraction (wm-platform crate)
• Wraps Win32 APIs, COM event hooks, keyboard hooks
• Provides unified interfaces for tracking windows, monitors, input
C. Common Types & Utilities (wm-common crate)
• DTOs for windows, containers, workspaces
• IPC message formats, serialization
• Shared math/types (points, rectangles, deltas)
D. IPC Layer
• Server: built into wm (in ipc_server.rs)
• Client: wm-ipc-client library & wm-cli executable
• Communication: named pipes or local socket; request/response model
E. CLI Tool (wm-cli crate)
• Parses user-entered commands
• Sends IPC messages to the running WM server
• Useful for scripting or manual control
F. Watcher Utility (wm-watcher crate)
• A small binary that launches alongside wm to re-spawn or monitor
• May detect process crashes / new windows that require special handling
G. Installer & Resources (resources/)
• WiX XML files for MSIX/bundles
• Sample YAML config, PowerShell packaging scripts
• Logo, cheatsheet, service configuration
H. Configuration File
• YAML based
• Defines keybindings, layouts, workspaces, window rules, effects
Architectural Patterns and Design Principles
• Layered Architecture:
• Platform layer (wm-platform)
• Core logic layer (wm) + shared DTOs (wm-common)
• Interface layer (IPC, CLI)
• Delivery layer (installer, scripts)
• Command Pattern:
• Submodules under wm/src/commands/... implement individual window commands
• Each command is serialized over IPC and executed in the engine
• Event-Driven:
• OS generates events → platform layer → dispatch to core → produce side effects
• Modular, Cargo Workspace:
• Clear separation of concerns; easy to test/use each crate independently