No description
Find a file
Ben Buhse b48032bbba
Change two uses of alloc to use stack buffers
I was looking for places where it might have made sense to use something
like an arena or a fba instead of the C allocator, but almost all of the
allocations are for Wayland interfaces that are fairly long lived (and,
since they're using libwayland, need the C allocator).

Instead, I just found two places that could use buffers on the stack
instead. In Config.zig, we *were* allocating the config path with
fmt.AllocPrint, but std.fs.max_path_bytes exists, so we can just make
a buf of that size and save a heap allocation. This is only at start up
and on config reload so it doesn't do too much, but I'd like to remove
allocations when possible.

The other change is for utils.parseModifiers(). It was using
std.ascii.allocLowerString(), but we clamp the length of the string to
3-5 characters, so we can just make a 5 character buffer and then use
ascii.lowerString() instead. Again, not super helpful since the function
is (currently) only called when creating Configs, but it's still nice to
get rid of a heap alloc.
2026-02-12 14:10:28 -06:00
docs Implement per-tag primary_count and primary_ratio 2026-02-12 14:10:21 -06:00
examples Implement per-tag primary_count and primary_ratio 2026-02-12 14:10:21 -06:00
LICENSES Add REUSE licensing for non-code files 2026-02-11 14:50:04 -06:00
protocol Implement river-input-management-v1 and river-libinput-config-v1 2026-02-09 12:55:47 -06:00
src Change two uses of alloc to use stack buffers 2026-02-12 14:10:28 -06:00
.gitignore initial commit 2025-05-03 21:07:26 -05:00
build.zig Add REUSE licensing for non-code files 2026-02-11 14:50:04 -06:00
build.zig.zon Add REUSE licensing for non-code files 2026-02-11 14:50:04 -06:00
README.md Update README.md, add docs/CONFIGURATION.md 2026-02-11 20:22:41 -06:00
REUSE.toml Update README.md, add docs/CONFIGURATION.md 2026-02-11 20:22:41 -06:00

beansprout

Overview

A tiling window manager for the river Wayland compositor written in Zig. The window manager communicates using the river-window-management-v1 protocol, as well as some of River's additional Wayland protocols.

Beansprout uses a primary/stack tiling layout inspired by dwm with a customizable ratio and primary count. Similarly, beansprout has a 32-bit tag system, rather than workspaces. Each output has its own tags and own primary count/ratio.

Building

Requires Zig 0.15.1 or later.

Dependencies

To compile beansprout, you'll need the dependencies found below. I've listed the package names for Gentoo and Debian/Ubuntu, but they likely exist on all major distros.

Needed at both build-time and runtime:

Dependency Gentoo Name Debian/Ubuntu Name
wayland-client dev-libs/wayland libwayland-dev
pixman x11-libs/pixman libpixman-1-dev
xkbcommon x11-libs/libxkbcommon libxkbcommon-dev

Only needed at build-time:

Dependency Gentoo Name Debian/Ubuntu Name
wayland-protocols dev-libs/wayland-protocols wayland-protocols

Note for Gentoo Users

Beansprout is available in my personal ebuild repo. Right now, it's just a live ebuild, but I will add versioned ebuilds once v0.1.0 is released.

Build

Build and install with:

zig build -Doptimize=ReleaseSafe --prefix ~/.local install

Run zig build -h to see a list of all options.

Usage

You can either add beansprout to the river init file or directly run river -c beansprout.

If you need to exit river, for example, if beansprout crashes, you can use river's hardcoded Ctrl+Alt+Delete keybind.

Configuration

Beansprout is configured with a KDL file at $XDG_CONFIG_HOME/beansprout/config.kdl. See docs/CONFIGURATION.md for a full reference and examples/config.kdl for an example config.

Licensing

This project follows the REUSE Specification, all files have SPDX copyright and license information and/or are listed under REUSE.toml.

In overview:

  • beansprout's source code is released under the GPL-3.0-only license.
  • beansprout's documentation is released under the CC-BY-4.0 license.
  • beansprout's examples are released under the CC0-1.0 license.

All licenses can be found under LICENSES