tony / oxwm

Branch: 67e1141
Switch branches/tags
master
tonybanters docs update 362633f 2026-09-20
280 lines · 8 KB Rendered Raw Blame History
1 ![oxwm](./images/oxwm1.png)
2
3 # OXWM: DWM but Better
4
5 A dynamic window manager written in Zig, inspired by dwm but designed to evolve beyond it. OXWM features a clean, functional Lua API for configuration with hot-reloading support, ditching the suckless philosophy of *"edit + recompile"*. Instead, we focus on lowering friction for users with sane defaults, LSP-powered autocomplete, and instant configuration changes without restarting your X session.
6
7 **Documentation:** [ox-docs.vercel.app](https://ox-docs.vercel.app/)
8
9 ## Installation
10
11 ### NixOS (nixpkgs)
12
13 Add OXWM to your `configuration.nix` like so:
14
15 ```nix
16 { config, pkgs, ... }:
17
18 {
19 services.xserver.windowManager.oxwm.enable = true;
20 }
21 ```
22
23 #### Initialize your config
24
25 After rebuilding your system with `sudo nixos-rebuild switch`, log in via your display manager.
26
27 On first launch, your initial config file will be automatically created and placed in `~/.config/oxwm/config.lua`. Edit it and reload with `Mod+Shift+R`.
28
29 #### Development setup with Nix
30
31 For development, use the provided dev shell:
32
33 ```sh
34 # Clone the repository
35 git clone https://github.com/tonybanters/oxwm
36 cd oxwm
37
38 # Enter the development environment
39 nix develop
40
41 # Build and test
42 zig build -Doptimize=ReleaseSmall
43 ```
44
45 ### Arch Linux
46
47 AUR: [oxwm-git](https://aur.archlinux.org/packages/oxwm-git)
48
49 ```sh
50 yay -S oxwm-git
51 ```
52
53 This will automatically put a desktop session file into your xsessions directory.
54
55 Manually, install the dependencies and see Building from Source:
56
57 ```sh
58 sudo pacman -S zig libx11 libxft freetype2 fontconfig libxinerama
59 ```
60
61 ### Building from Source
62
63 Note, on many BSD systems, the zig compiler will aggressively attempt to remove debug symbols which is causing a known linker issue. Please use this method on BSD:
64
65 ```sh
66 git clone https://github.com/tonybanters/oxwm
67 cd oxwm
68 zig build
69 ```
70
71 On other legacy distros, just use:
72
73 ```sh
74 git clone https://github.com/tonybanters/oxwm
75 cd oxwm
76 zig build -Doptimize=ReleaseSmall --prefix /usr
77 ```
78
79 ### Setting up OXWM
80
81 #### Without a display manager (startx)
82
83 Add the following to your `~/.xinitrc`:
84
85 ```sh
86 exec oxwm
87 ```
88
89 Then start X with:
90
91 ```sh
92 startx
93 ```
94
95 #### With a display manager
96
97 If using a display manager (LightDM, GDM, SDDM), OXWM should appear in the session list after installation.
98
99 ## Configuration
100
101 OXWM uses a clean, functional Lua API for configuration. On first run, a default config is automatically created at `~/.config/oxwm/config.lua`.
102
103 ### Quick Example
104
105 Here's what the functional API looks like:
106
107 ```lua
108 -- Set basic options
109 oxwm.set_terminal("st")
110 oxwm.set_modkey("Mod4")
111 oxwm.set_tags({ "1", "2", "3", "4", "5", "6", "7", "8", "9" })
112
113 -- Configure borders
114 oxwm.border.set_width(2)
115 oxwm.border.set_focused_color("#6dade3")
116 oxwm.border.set_unfocused_color("#bbbbbb")
117
118 -- Configure gaps
119 oxwm.gaps.set_enabled(true)
120 oxwm.gaps.set_inner(5, 5) -- horizontal, vertical
121 oxwm.gaps.set_outer(5, 5)
122
123 -- Set up keybindings
124 oxwm.key.bind({ "Mod4" }, "Return", oxwm.spawn("st"))
125 oxwm.key.bind({ "Mod4" }, "Q", oxwm.client.kill())
126 oxwm.key.bind({ "Mod4", "Shift" }, "Q", oxwm.quit())
127
128 -- Add status bar blocks
129 oxwm.bar.set_blocks({
130 oxwm.bar.block.datetime({
131 format = "{}",
132 date_format = "%H:%M",
133 interval = 60,
134 color = "#0db9d7",
135 underline = true,
136 }),
137 oxwm.bar.block.ram({
138 format = "RAM: {used}/{total} GB",
139 interval = 5,
140 color = "#7aa2f7",
141 underline = true,
142 }),
143 })
144 ```
145
146 ### Key Configuration Areas
147
148 Edit `~/.config/oxwm/config.lua` to customize:
149
150 - Basic settings (terminal, modkey, tags)
151 - Borders and colors
152 - Window gaps
153 - Status bar (font, blocks, color schemes)
154 - Keybindings and keychords
155 - Layouts, layout symbols, and attach method
156 - Window rules
157 - Autostart commands
158
159 After making changes, reload OXWM with `Mod+Shift+R`.
160
161 ### Creating Your Config
162
163 Generate the default config:
164
165 ```sh
166 oxwm --init
167 ```
168
169 Or just start OXWM. It will create one automatically on first run.
170
171 ## Contributing
172
173 When contributing to OXWM:
174
175 1. Never commit your personal `~/.config/oxwm/config.lua`
176 2. Only modify `templates/config.lua` if adding new configuration options
177 3. Test your changes with `zig build xephyr` using Xephyr or `zig build xwayland` using Xwayland
178 4. Document any new features or keybindings
179
180 ## Key Bindings
181
182 Default keybindings (fully customizable in `~/.config/oxwm/config.lua`):
183
184 | Binding | Action |
185 |------------------------|-----------------------------------|
186 | Super+Return | Spawn terminal |
187 | Super+J/K | Cycle focus through stack |
188 | Super+Q | Kill focused window |
189 | Super+Shift+Q | Quit WM |
190 | Super+Shift+R | Hot reload WM |
191 | Super+1-9 | View tag 1-9 |
192 | Super+Shift+1-9 | Move window to tag 1-9 |
193 | Super+Ctrl+1-9 | Toggle tag view (multi-tag) |
194 | Super+Ctrl+Shift+1-9 | Toggle window tag (sticky) |
195 | Super+S | Screenshot (maim) |
196 | Super+D | dmenu launcher |
197 | Super+A | Toggle gaps |
198 | Super+Shift+F | Toggle fullscreen |
199 | Super+Shift+Space | Toggle floating |
200 | Super+F | Set normie (floating) layout |
201 | Super+C | Set tiling layout |
202 | Super+N | Cycle layouts |
203 | Super+Comma/Period | Focus prev/next monitor |
204 | Super+Shift+Comma/. | Send window to prev/next monitor |
205 | Super+[/] | Decrease/increase master area |
206 | Super+I/P | Inc/dec number of master windows |
207 | Super+Shift+/ | Show keybinds overlay |
208 | Super+Button1 (drag) | Move window (floating) |
209 | Super+Button3 (drag) | Resize window (floating) |
210
211 ## Features
212
213 - **Dynamic Tiling Layout** with adjustable master/stack split
214 - Master area resizing (mfact)
215 - Multiple master windows support (nmaster)
216 - **Tag-Based Workspaces** (9 tags by default, up to 12)
217 - Multi-tag viewing (see multiple tags at once)
218 - Sticky windows (window visible on multiple tags)
219 - **Multiple Layouts**
220 - Tiling (master/stack)
221 - Normie (floating-by-default)
222 - Monocle (fullscreen stacking)
223 - Grid (equal-sized grid)
224 - Scrolling (horizontal scroll)
225 - Dwindle (fibonacci spiral)
226 - **Configurable Attach Method** for new windows: aside, top, bottom, above, or below
227 - **Lua Configuration System**
228 - Hot reload without restarting X (`Mod+Shift+R`)
229 - LSP support with type definitions and autocomplete
230 - No compilation needed, instant config changes
231 - **Built-in Status Bar** with modular block system
232 - Battery, RAM, CPU temperature, datetime, shell commands, static text, systray
233 - Custom colors, update intervals, and underlines
234 - Click-to-switch tags
235 - Multi-monitor support (one bar per monitor)
236 - **Advanced Window Management**
237 - Window focus cycling through stack
238 - Fullscreen mode
239 - Floating window support
240 - Mouse hover to focus (follow mouse)
241 - Border indicators for focused windows
242 - Configurable gaps (smartgaps support)
243 - Window rules (auto-tag, auto-float by class/title)
244 - **Multi-Monitor Support**
245 - Xinerama multi-monitor detection with hotplug
246 - Independent tags per monitor
247 - Move windows between monitors
248 - **Keychord Support**
249 - Multi-key sequences (Emacs/Vim style)
250 - Example: `Mod+Space` then `T` to spawn terminal
251 - **Persistent State**
252 - Window tags persist across WM restarts
253 - Uses X11 properties for state storage
254
255 ## Testing with Xephyr
256
257 Test OXWM in a nested X server without affecting your current session:
258
259 ```sh
260 zig build xephyr
261 ```
262
263 This starts Xephyr on display :2 and launches OXWM inside it.
264
265 For multi-monitor testing:
266
267 ```sh
268 zig build xephyr-multi
269 ```
270
271 Or manually:
272
273 ```sh
274 Xephyr -screen 1280x800 :2 &
275 DISPLAY=:2 zig build run
276 ```
277
278 ## License
279
280 [GPL v3](https://www.gnu.org/licenses/gpl-3.0.en.html)