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

@ -151,6 +151,14 @@ pub fn manage(context: *Context) void {
context.config = new_config;
context.initialized = false;
// Update output defaults from new config
var out_it_cfg = context.wm.outputs.iterator(.forward);
while (out_it_cfg.next()) |output| {
output.primary_ratio = new_config.primary_ratio;
output.primary_count = new_config.primary_count;
output.single_window_ratio = new_config.single_window_ratio;
}
// Mark all libinput devices as needing config re-application
var dev_it = context.im.libinput_devices.iterator(.forward);
while (dev_it.next()) |libinput_device| {