How tdaron/tdawm works
Project type and purpose
• This is a systems-level application: an X11 window manager (“TDAWm”) written in Rust.
• It sits between the X server and user applications, managing windows, layouts, workspaces, screens, and event dispatch.
File structure
• src/main.rs: entry point, initializes the event loop and the window-manager context.
• src/x11.rs: low-level X11 bindings / wrappers—connection, event fetching, Xlib calls.
• src/tdawm/: core WM domain objects and logic
• context.rs: global state (open windows, workspaces, screens)
• tdawm.rs: main WM loop, event dispatcher, command router
• screen.rs / workspace.rs / window.rs: representations of physical displays, virtual desktops, individual windows
• src/layouts/: layout algorithms (vertical, horizontal, dwm-style)
• justfile, Cargo.toml: build & run tooling
README
• Confirms it is a proof-of-concept X11 WM.
• No external services, just X11 on Linux.
• Roadmap: multi-screen, EWMH support—future expansions.
Components
a. Main components
1. X Server (external service)
2. X11 Client Library (src/x11.rs)
3. WM Core
• Event Loop & Dispatcher (tdawm.rs)
• Context (context.rs)
4. Data Models
• Screens (screen.rs)
• Workspaces (workspace.rs)
• Windows (window.rs)
5. Layout Engine (vertical.rs, horizontal.rs, dwm.rs)
6. Configuration Loader (config/mod.rs)
7. CLI / Entry Point (main.rs)
b. Relationships and interactions
• Entry Point (main.rs) calls Config Loader → initializes Context → connects to X11 via x11.rs → enters Event Loop in tdawm.rs.
• Event Loop pulls events from X Server (via x11.rs) → Dispatcher routes to handlers (window mapping, focus changes, reflows).
• Layout Engine computes window placements within each Workspace on each Screen.
• Context updates Data Models (Screens, Workspaces, Windows).
• Config controls keybindings and layout choices.
c. Architectural patterns
• Modular separation: low-level X11 API vs. core WM logic vs. layout algorithms.
• Single event loop (reactor pattern) dispatching to subsystems.
• MVC-like: Model = Context + Data Models; Controller = Dispatcher / tm loop; View = X11 redraw calls.
d. Key technologies
• Rust (Cargo)
• Xlib bindings (via x11.rs)
• justfile (task runner)
Detailed capture of essential elements
• Stateful context store that holds open windows/workspaces/screens.
• Modular plug-in nature of layouts and the config loader.