tony / oxwm

Branch: b33b7bb
Switch branches/tags
master
tonybanters fixed merge conflicts. b33b7bb 2026-10-12
297 lines · 9 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 libinput systemd-libs
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 Touchpad swipe gestures for the scrolling layout use libinput and libudev, which only exist on Linux. They are built in by default and skipped automatically on BSD targets. Pass `-Dno_gestures` to leave them out anywhere, or use `zig build openbsd` (also `freebsd`, `netbsd`, `bsd`) which does the same and installs the result.
95
96 ### Setting up OXWM
97
98 #### Without a display manager (startx)
99
100 Add the following to your `~/.xinitrc`:
101
102 ```sh
103 exec oxwm
104 ```
105
106 Then start X with:
107
108 ```sh
109 startx
110 ```
111
112 #### With a display manager
113
114 If using a display manager (LightDM, GDM, SDDM), OXWM should appear in the session list after installation.
115
116 ## Configuration
117
118 OXWM uses a clean, functional Lua API for configuration. On first run, a default config is automatically created at `~/.config/oxwm/config.lua`.
119
120 ### Quick Example
121
122 Here's what the functional API looks like:
123
124 ```lua
125 -- Set basic options
126 oxwm.set_terminal("st")
127 oxwm.set_modkey("Mod4")
128 oxwm.set_tags({ "1", "2", "3", "4", "5", "6", "7", "8", "9" })
129
130 -- Configure borders
131 oxwm.border.set_width(2)
132 oxwm.border.set_focused_color("#6dade3")
133 oxwm.border.set_unfocused_color("#bbbbbb")
134
135 -- Configure gaps
136 oxwm.gaps.set_enabled(true)
137 oxwm.gaps.set_inner(5, 5) -- horizontal, vertical
138 oxwm.gaps.set_outer(5, 5)
139
140 -- Set up keybindings
141 oxwm.key.bind({ "Mod4" }, "Return", oxwm.spawn("st"))
142 oxwm.key.bind({ "Mod4" }, "Q", oxwm.client.kill())
143 oxwm.key.bind({ "Mod4", "Shift" }, "Q", oxwm.quit())
144
145 -- Add status bar blocks
146 oxwm.bar.set_blocks({
147 oxwm.bar.block.datetime({
148 format = "{}",
149 date_format = "%H:%M",
150 interval = 60,
151 color = "#0db9d7",
152 underline = true,
153 }),
154 oxwm.bar.block.ram({
155 format = "RAM: {used}/{total} GB",
156 interval = 5,
157 color = "#7aa2f7",
158 underline = true,
159 }),
160 })
161 ```
162
163 ### Key Configuration Areas
164
165 Edit `~/.config/oxwm/config.lua` to customize:
166
167 - Basic settings (terminal, modkey, tags)
168 - Borders and colors
169 - Window gaps
170 - Status bar (font, blocks, color schemes)
171 - Keybindings and keychords
172 - Layouts, layout symbols, and attach method
173 - Window rules
174 - Autostart commands
175
176 After making changes, reload OXWM with `Mod+Shift+R`.
177
178 ### Creating Your Config
179
180 Generate the default config:
181
182 ```sh
183 oxwm --init
184 ```
185
186 Or just start OXWM. It will create one automatically on first run.
187
188 ## Contributing
189
190 When contributing to OXWM:
191
192 1. Never commit your personal `~/.config/oxwm/config.lua`
193 2. Only modify `templates/config.lua` if adding new configuration options
194 3. Test your changes with `zig build xephyr` using Xephyr or `zig build xwayland` using Xwayland
195 4. Document any new features or keybindings
196
197 ## Key Bindings
198
199 Default keybindings (fully customizable in `~/.config/oxwm/config.lua`):
200
201 | Binding | Action |
202 |------------------------|-----------------------------------|
203 | Super+Return | Spawn terminal |
204 | Super+J/K | Cycle focus through stack |
205 | Super+Q | Kill focused window |
206 | Super+Shift+Q | Quit WM |
207 | Super+Shift+R | Hot reload WM |
208 | Super+1-9 | View tag 1-9 |
209 | Super+Shift+1-9 | Move window to tag 1-9 |
210 | Super+Ctrl+1-9 | Toggle tag view (multi-tag) |
211 | Super+Ctrl+Shift+1-9 | Toggle window tag (sticky) |
212 | Super+S | Screenshot (maim) |
213 | Super+D | dmenu launcher |
214 | Super+A | Toggle gaps |
215 | Super+Shift+F | Toggle fullscreen |
216 | Super+Shift+Space | Toggle floating |
217 | Super+F | Set normie (floating) layout |
218 | Super+C | Set tiling layout |
219 | Super+N | Cycle layouts |
220 | Super+Comma/Period | Focus prev/next monitor |
221 | Super+Shift+Comma/. | Send window to prev/next monitor |
222 | Super+[/] | Decrease/increase master area |
223 | Super+I/P | Inc/dec number of master windows |
224 | Super+Shift+/ | Show keybinds overlay |
225 | Super+Button1 (drag) | Move window (floating) |
226 | Super+Button3 (drag) | Resize window (floating) |
227
228 ## Features
229
230 - **Dynamic Tiling Layout** with adjustable master/stack split
231 - Master area resizing (mfact)
232 - Multiple master windows support (nmaster)
233 - **Tag-Based Workspaces** (9 tags by default, up to 12)
234 - Multi-tag viewing (see multiple tags at once)
235 - Sticky windows (window visible on multiple tags)
236 - **Multiple Layouts**
237 - Tiling (master/stack)
238 - Normie (floating-by-default)
239 - Monocle (fullscreen stacking)
240 - Grid (equal-sized grid)
241 - Scrolling (niri-style horizontal strip with per-window widths and three-finger touchpad swipes)
242 - Dwindle (fibonacci spiral)
243 - **Configurable Attach Method** for new windows: aside, top, bottom, above, or below
244 - **Lua Configuration System**
245 - Hot reload without restarting X (`Mod+Shift+R`)
246 - LSP support with type definitions and autocomplete
247 - No compilation needed, instant config changes
248 - **Built-in Status Bar** with modular block system
249 - Battery, RAM, CPU temperature, datetime, shell commands, static text, systray
250 - Custom colors, update intervals, and underlines
251 - Click-to-switch tags
252 - Multi-monitor support (one bar per monitor)
253 - **Advanced Window Management**
254 - Window focus cycling through stack
255 - Fullscreen mode
256 - Floating window support
257 - Mouse hover to focus (follow mouse)
258 - Border indicators for focused windows
259 - Configurable gaps (smartgaps support)
260 - Window rules (auto-tag, auto-float by class/title)
261 - **Multi-Monitor Support**
262 - Xinerama multi-monitor detection with hotplug
263 - Independent tags per monitor
264 - Move windows between monitors
265 - **Keychord Support**
266 - Multi-key sequences (Emacs/Vim style)
267 - Example: `Mod+Space` then `T` to spawn terminal
268 - **Persistent State**
269 - Window tags persist across WM restarts
270 - Uses X11 properties for state storage
271
272 ## Testing with Xephyr
273
274 Test OXWM in a nested X server without affecting your current session:
275
276 ```sh
277 zig build xephyr
278 ```
279
280 This starts Xephyr on display :2 and launches OXWM inside it.
281
282 For multi-monitor testing:
283
284 ```sh
285 zig build xephyr-multi
286 ```
287
288 Or manually:
289
290 ```sh
291 Xephyr -screen 1280x800 :2 &
292 DISPLAY=:2 zig build run
293 ```
294
295 ## License
296
297 [GPL v3](https://www.gnu.org/licenses/gpl-3.0.en.html)