Add layer shell support and fix floating windows

Now, I actually save the river-layer-shell-v1 and keep track of the
non-exclusive area. The layout calculation uses the usable area instead
of the entire output's geometry.

I removed boundary clamping for the floating windows because it was a
bit janky when hitting the edges. I'll probably add it back at some
point. I also made windows default to 75% of the usable area instead of
keeping their tiled size so that maximized windows look decent when
floating for the first time. Finally, since I removed the clamping, I
added a center_float keybind to center a floating window. If you're
cycling through focused windows and one isn't on the screen, you can use
the center_float bind to get the window visible again.

Replaced all divTrunc with divFloor to be consistent. I think they
should all be positive, anyways, so they'd be the same, but I like just
having one.
This commit is contained in:
Ben Buhse 2026-02-14 11:29:00 -06:00
commit 5c427234d7
No known key found for this signature in database
GPG key ID: 7916ACFCD38FD0B4
9 changed files with 108 additions and 71 deletions

View file

@ -14,6 +14,7 @@ wl_registry: *wl.Registry,
wl_shm: *wl.Shm,
wl_outputs: *std.AutoHashMapUnmanaged(u32, *wl.Output),
river_layer_shell_v1: *river.LayerShellV1,
zwlr_layer_shell_v1: *zwlr.LayerShellV1,
// Wayland globals that we have special structs for
@ -68,6 +69,7 @@ pub fn create(options: Options) !*Context {
.wl_registry = options.wl_registry,
.wl_shm = options.wl_shm,
.wl_outputs = options.wl_outputs,
.river_layer_shell_v1 = options.river_layer_shell_v1,
.zwlr_layer_shell_v1 = options.zwlr_layer_shell_v1,
.wallpaper_image = loadWallpaperImage(options.config),
.im = try InputManager.create(context, options.river_input_manager_v1, options.river_libinput_config_v1),