tony / oxwm

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