tony / oxwm

Branch: f198c24
Switch branches/tags
master
tonybtw fixed readme 7443210 2025-09-29
152 lines · 5.4 KB Rendered Raw Blame History
1 #+AUTHOR: Tony
2 #+STARTUP: overview
3
4 * OXWM — DWM but Better (and oxidized)
5 A dynamic window manager written in Rust, inspired by dwm but designed to evolve
6 on its own. Configuration is done in Rust source code, keeping with the suckless
7 philosophy of *"edit + recompile."*
8
9 This project is still in its early stages. Currently, it can claim ownership of
10 an X display and log incoming events.
11
12 * Project Structure
13
14 #+begin_src sh
15 src/
16 ├── main.rs
17 │ └── main()
18 │ └── Creates WindowManager and calls .run()
19 │
20 ├── window_manager.rs [CORE - X11 event handling]
21 │ ├── struct WindowManager
22 │ │ ├── connection: RustConnection [X11 connection]
23 │ │ ├── windows: Vec<Window> [All managed windows]
24 │ │ ├── focused_window: Option<Window>
25 │ │ └── layout: Box<dyn Layout>
26 │ │
27 │ ├── new() [Initialize WM, grab root]
28 │ ├── run() [Main event loop]
29 │ ├── handle_event() [Route X11 events]
30 │ │ ├── MapRequest → add window, apply layout
31 │ │ ├── UnmapNotify → remove window
32 │ │ ├── DestroyNotify → remove window
33 │ │ └── KeyPress → get action, handle it
34 │ ├── handle_key_action() [Execute keyboard actions]
35 │ ├── remove_window() [Remove from Vec, reapply layout]
36 │ ├── set_focus() [Focus window, update visuals]
37 │ ├── cycle_focus() [Move focus to next window]
38 │ ├── update_focus_visuals() [Set border colors]
39 │ └── apply_layout() [Position all windows]
40 │
41 ├── keyboard/
42 │ ├── mod.rs [Re-exports]
43 │ ├── keycodes.rs [Key constants: Q, J, RETURN, etc]
44 │ └── handlers.rs
45 │ ├── enum KeyAction [SpawnTerminal, CloseWindow, CycleWindow, Quit, None]
46 │ ├── setup_keybinds() [Register keys with X11]
47 │ └── handle_key_press() [Parse KeyPressEvent → KeyAction]
48 │
49 └── layout/
50 ├── mod.rs [Layout trait definition]
51 └── tiling.rs
52 └── TilingLayout::arrange() [Calculate window positions]
53 #+end_src
54
55 * Event Flow
56
57 1. X11 event arrives → run() receives it
58 2. handle_event() matches event type
59 3. For KeyPress:
60 - keyboard::handle_key_press() → KeyAction
61 - handle_key_action() executes action
62 4. For Map/Unmap:
63 - Modify windows Vec
64 - apply_layout() repositions everything
65 - update_focus_visuals() redraws borders
66
67 * Key Bindings
68
69 | Binding | Action |
70 |---------------+----------------------|
71 | Alt+Return | Spawn terminal |
72 | Alt+J | Cycle focus |
73 | Alt+Shift+Q | Close focused window |
74 | Alt+Shift+Q | Quit WM |
75
76 * ⚙ Installation — Running with Nix Flakes
77 You can set up a reproducible development environment with Rust, Cargo, Xephyr, xterm, and
78 just by using the flake.
79
80 #+begin_src sh
81 git clone https://github.com/tonybanters/oxwm
82 cd oxwm
83
84 # enter the dev shell
85 nix develop
86
87 # build normally
88 cargo build
89 #+end_src
90
91 * Testing Xephyr with Justfile
92 The =justfile= includes a =test= recipe that starts Xephyr on =:1=, launches
93 test clients (xterm, xclock), and runs oxwm in the foreground.
94
95 #+begin_src sh
96 # inside nix develop
97 just test
98 #+end_src
99
100 This should open a new Xephyr window. oxwm will attach to it and log X11
101 events in your host terminal. Clients like xterm/xclock will appear inside Xephyr.
102
103 * OXWM Todo List:
104 ** TODO Reorganization Tasks [1/2]
105 - [X] Move keyboard module to folder structure:
106 - [X] Create =src/keyboard/mod.rs= with re-exports
107 - [X] Move constants to =src/keyboard/keycodes.rs=
108 - [X] Move key handlers to =src/keyboard/handlers.rs=
109 - [X] Update imports in main.rs and window_manager.rs
110 - [ ] Create =src/config.rs= in root directory for future configuration system
111
112 ** TODO Core Window Management [1/2]
113 - [X] Fix layout after program is closed (handle UnmapNotify events)
114 - [X] Add UnmapNotify to event handling
115 - [X] Remove closed windows from windows vector
116 - [X] Re-apply layout after window removal
117 - [ ] Add keybind to swap focus between windows
118 - [ ] Track focused window in WindowManager struct
119 - [ ] Implement focus cycling logic
120 - [ ] Add visual focus indication (borders/colors)
121
122 ** Key System Improvements
123 - [ ] Connect config.rs to keyboard system for dynamic keybind generation
124 - [ ] Add more dwm-like keybinds:
125 - [ ] Window focus switching (Alt+J/K)
126 - [ ] Master area resizing
127 - [ ] Layout switching
128 - [ ] Workspace/tag management
129 - [ ] Better error handling for failed key grabs
130
131 ** Layout System
132 - [ ] Add more layout types (monocle, floating)
133 - [ ] Handle window resize requests properly
134 - [ ] Add configurable gaps between windows
135 - [ ] Implement layout switching keybinds
136
137 ** Polish & Features
138 - [ ] Clean window destruction/cleanup
139 - [ ] Handle edge cases (empty window list, invalid windows)
140 - [ ] Add status bar integration
141 - [ ] Better error messages and logging
142
143 ** Priority
144 Reorganization and UnmapNotify handling should be immediate priorities.
145
146 * Status
147 - Rust + x11rb skeleton running
148 - Nix flake devShell available
149 - =just test= launches Xephyr, clients, and oxwm
150
151 * License
152 [[https://www.gnu.org/licenses/gpl-3.0.en.html][GPL]]