Implement single_window_ratio

This is a new config option that allows the user to set the width ratio
when only a single window is tiled and visible. The main idea is that,
on ultrawides, a single window taking the full width could be ugly.
With this new config, you can make the window take a smaller width.

I also renamed consts to snake_case instead of SCREAMING_CASE and fixed
a bug where the default primary_count and primary_ratio weren't updated
on config reload.
This commit is contained in:
Ben Buhse 2026-02-25 13:49:43 -06:00
commit b921751100
No known key found for this signature in database
GPG key ID: 7916ACFCD38FD0B4
6 changed files with 74 additions and 10 deletions

View file

@ -4,7 +4,7 @@
const WindowManager = @This();
const MIN_RIVER_SEAT_V1_VERSION: u2 = 3;
const min_river_seat_v1_version: u2 = 3;
context: *Context,
@ -239,9 +239,9 @@ fn windowManagerV1Listener(window_manager_v1: *river.WindowManagerV1, event: riv
.seat => |ev| {
const river_seat_v1 = ev.id;
const river_seat_v1_version = river_seat_v1.getVersion();
if (river_seat_v1_version < MIN_RIVER_SEAT_V1_VERSION) {
if (river_seat_v1_version < min_river_seat_v1_version) {
@branchHint(.cold); // If we're in here, the program is exiting anyways
utils.versionNotSupported(river.SeatV1, river_seat_v1_version, MIN_RIVER_SEAT_V1_VERSION);
utils.versionNotSupported(river.SeatV1, river_seat_v1_version, min_river_seat_v1_version);
}
const seat = Seat.create(context, river_seat_v1) catch @panic("Out of memory");