2zw
===
2zw is a fast, lean window manager for X written in Zig.
It follows the 2wm design from suckless.org but is reworked in Zig for type safety while keeping the same minimalist behaviour.
The codebase now targets portable POSIX APIs so it builds cleanly on both Linux and OpenBSD.
Features
--------
- Small hackable codebase (~1.8k LOC)
- Master/stack tiling
- Attach/detach instead of workspaces
- No configuration file parsing, configured via source
- Floating window support
- Focus border colouring
- Bar (bat, date/time)
- Only depends on X11 and Zig std
- Client state stored in contiguous arrays for better cache use
Requirements
------------
In order to build 2zw you need:
- Zig compiler (0.13.0 or newer, tested with 0.14.0)
- Xlib header files
- libX11-dev
- libXrandr-dev
- On OpenBSD these live under `/usr/X11R6`; the build script adds the paths automatically.
Installation
------------
Edit `build.zig` to match your local setup if you want a different prefix
(2zw installs into `/usr/local` namespace by default). No manual edits are required
for OpenBSD include/library search paths.
Afterwards enter the following command to build and install 2zw:
zig build install
Running 2zw
-----------
Add the following line to your .xinitrc to start 2zw using startx:
exec 2zw
In order to connect 2zw to a specific display, make sure that
the DISPLAY environment variable is set correctly, e.g.:
DISPLAY=foo.bar:1 exec 2zw
Configuration
-------------
Everything lives in `src/main.zig`; edit constants and rebuild.
Defaults worth noting:
- `FOCUS_BORDER_COLOR = 0xffd787`
- `NORMAL_BORDER_COLOR = 0x333333`
- `BORDER_WIDTH = 2`
- `terminal = "st"`
- `launcher = "dmenu_run"`
Key bindings (Mod4): q kill, a attach, d detach, , prev, . next, Return terminal, p launcher, s slock.