a window manager for x11
- 15 commits
- 1 branch
- 0 tags
| src | 2025-09-29 | |
| .envrc | 2025-09-24 | |
| .gitignore | 2025-09-24 | |
| Cargo.lock | 2025-09-19 | |
| Cargo.toml | 2025-09-19 | |
| flake.lock | 2025-09-19 | |
| flake.nix | 2025-09-24 | |
| justfile | 2025-09-26 | |
| readme.org | 2025-09-29 |
readme.org
OXWM — DWM but Better (and oxidized)
A dynamic window manager written in Rust, inspired by dwm but designed to evolve on its own. Configuration is done in Rust source code, keeping with the suckless philosophy of "edit + recompile."
This project is still in its early stages. Currently, it can claim ownership of an X display and log incoming events.
Project Structure
src/
main.rs
- main(): Creates WindowManager and calls .run()
window_manager.rs (CORE)
Handles all X11 events and window management
struct WindowManager
- connection: X11 connection
- windows: Vec<Window> (all managed windows)
- focused_window: Option<Window>
- layout: Box<dyn Layout>
Methods
- new(): Initialize WM, grab root window
- run(): Main event loop
- handle_event(): Routes X11 events
- MapRequest → add window, apply layout
- UnmapNotify → remove window
- DestroyNotify → remove window
- KeyPress → get action, handle it
- handle_key_action(): Execute keyboard actions
- remove_window(): Remove from Vec, reapply layout
- set_focus(): Focus window, update visuals
- cycle_focus(): Move focus to next window
- update_focus_visuals(): Set border colors
- apply_layout(): Position all windows
keyboard/
mod.rs
- Re-exports public interface
keycodes.rs
- Key constants (Q, J, RETURN, etc)
handlers.rs
- enum KeyAction: SpawnTerminal, CloseWindow, CycleWindow, Quit, None
- setup_keybinds(): Register keys with X11
- handle_key_press(): Parse key → return KeyAction
layout/
mod.rs
- Layout trait definition
tiling.rs
- TilingLayout: Implementation
- arrange(): Calculate window positions
Event Flow
- X11 event arrives → run() receives it
- handle_event() matches event type
- For KeyPress:
- keyboard::handle_key_press() → KeyAction
- handle_key_action() executes action
- For Map/Unmap:
- Modify windows Vec
- apply_layout() repositions everything
- update_focus_visuals() redraws borders
Key Bindings
| Binding | Action |
|---|---|
| Alt+Return | Spawn terminal |
| Alt+J | Cycle focus |
| Alt+Shift+Q | Close focused window |
| Alt+Shift+Q | Quit WM |
⚙ Installation — Running with Nix Flakes
You can set up a reproducible development environment with Rust, Cargo, Xephyr, xterm, and just by using the flake.
git clone https://github.com/tonybanters/oxwm
cd oxwm
# enter the dev shell
nix develop
# build normally
cargo build
Testing Xephyr with Justfile
The justfile includes a test recipe that starts Xephyr on :1, launches
test clients (xterm, xclock), and runs oxwm in the foreground.
# inside nix develop
just test
This should open a new Xephyr window. oxwm will attach to it and log X11 events in your host terminal. Clients like xterm/xclock will appear inside Xephyr.
OXWM Todo List:
TODO Reorganization Tasks [1/2]
- ☑ Move keyboard module to folder structure:
- ☑ Create
src/keyboard/mod.rswith re-exports - ☑ Move constants to
src/keyboard/keycodes.rs - ☑ Move key handlers to
src/keyboard/handlers.rs - ☑ Update imports in main.rs and window_manager.rs
- ☑ Create
- ☐ Create
src/config.rsin root directory for future configuration system
TODO Core Window Management [1/2]
- ☑ Fix layout after program is closed (handle UnmapNotify events)
- ☑ Add UnmapNotify to event handling
- ☑ Remove closed windows from windows vector
- ☑ Re-apply layout after window removal
- ☐ Add keybind to swap focus between windows
- ☐ Track focused window in WindowManager struct
- ☐ Implement focus cycling logic
- ☐ Add visual focus indication (borders/colors)
Key System Improvements
- ☐ Connect config.rs to keyboard system for dynamic keybind generation
- ☐ Add more dwm-like keybinds:
- ☐ Window focus switching (Alt+J/K)
- ☐ Master area resizing
- ☐ Layout switching
- ☐ Workspace/tag management
- ☐ Better error handling for failed key grabs
Layout System
- ☐ Add more layout types (monocle, floating)
- ☐ Handle window resize requests properly
- ☐ Add configurable gaps between windows
- ☐ Implement layout switching keybinds
Polish & Features
- ☐ Clean window destruction/cleanup
- ☐ Handle edge cases (empty window list, invalid windows)
- ☐ Add status bar integration
- ☐ Better error messages and logging
Priority
Reorganization and UnmapNotify handling should be immediate priorities.
Status
- Rust + x11rb skeleton running
- Nix flake devShell available
just testlaunches Xephyr, clients, and oxwm