tony / oxwm

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