mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-01-11 14:40:25 +01:00
[BUG]: Custom layout change requests are ignored #190
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @thesobercoder on GitHub (Apr 7, 2023).
Describe the bug
Custom layout change requests are being ignored by Komorebi when there are only three windows on the screen. I use an utrawide 49in monitor and I typically have two layouts that I switch between. It all works fine when there are
>3windows on screen but when there are exactly=3windows, the layout change requests are ignored, and nothing happens.Layout 1:
Layout 2:
To Reproduce
Steps to reproduce the behavior:
layout1.yamlandlayout2.yamlrespectively.layout1.yamlby addingkomorebic.exe load-custom-layout ~/layouts/layout1.yamlto yourkomorebi.ps1configuration file.komorebic start --await-configuration.komorebic.exe load-custom-layout ~/layouts/layout2.yaml.Expected behavior
The layout should have changed and assigned the primary section window 50% of the screen width, but the change requests are ignored. Once you add a fourth window, the layout change suddenly starts to work.
Operating System
Additional context
Once you add a fourth window, the layout change suddenly starts to work.
@LGUG2Z commented on GitHub (Apr 9, 2023):
I think what you are experiencing is the intended behaviour: if the number of containers is not greater than the number of columns defined in the custom layout, the arrangement falls back to a simple column layout.
I'm open to PRs to improve the custom layout algorithm and remove this requirement for the number of containers needing to be greater than the number of columns, but I'm afraid that the state it is in right now is the limit of my own personal ability (hence the
columnslayout fallback).I'll leave this issue open and label it as a feature request that needs help to be progressed.
@thesobercoder commented on GitHub (Apr 9, 2023):
@LGUG2Z I think changing the condition to something like
if the number of containers >= number of columnsinstead of onlygreatershould be a non-breaking change, no? I'm a C# programmer by profession and not a Rust expert by any means, but here is what I think the change should be.0de3fa62f0/komorebi-core/src/arrangement.rs (L234)Instead of using
<=if you replace it with<, should technically translate to the logic I mentioned above.Please let me know what you think, and thanks for all your hard work on komorebi which makes our lives easier every day!
@olivoil commented on GitHub (Jun 15, 2023):
@LGUG2Z I'm interested in this as well, is there more to this than what @thesobercoder is suggesting?
It seems logical that if a layout defines 3 columns, and there are exactly 3 containers on screen, it should be able to apply this layout, and the fallback to a column layout should only be needed if there are 2 or less containers on screen, don't you think?
@LGUG2Z commented on GitHub (Jun 15, 2023):
Unfortunately, it doesn't work as expected. Making that change results in this rendering with the following custom layout:
@LGUG2Z commented on GitHub (Jun 15, 2023):
Layouts are unfortunately not something I'm best suited to working on; I have a poor intuition for geometry and layout and whenever I'm trying to work on code like this for more than 10 minutes I start getting headaches because it's so mentally taxing :/
@thesobercoder commented on GitHub (Jun 15, 2023):
@LGUG2Z I switched to the default layouts, and it has been working pretty well for me. Geometry hurts my head too, so I can totally relate. 😄
@olivoil commented on GitHub (Jun 17, 2023):
@LGUG2Z It looks like your screenshot is what I would expect with
configuration: !Horizontal 2in the Secondary column, it does not have enough containers to start filling the tertiary column, and the primary column is at 45%, leaving the secondary one to fill out the rest of the screen. This does seem to be working, doesn't it?Would the change work with this config?
In komorebi.layout.json:
And applying as soon as there are 3 windows on screen:
At the moment, this does not work as it applies
komorebi.layout.jsononly until there are 4 windows. When there are only 3, it fallbacks to the column layout, resulting in 3 columns of equal width@LGUG2Z commented on GitHub (Jul 1, 2023):
@olivoil I think you're right and I'm overthinking this and/or my own mental model is a little skewed by the specific custom layouts that I use. I'm going to add this change to the master branch and it will be in the next release, so that custom layout changes are triggered when there are at least as many windows open as columns in the custom layout.
Thanks to all of you for your patience with this!
@thesobercoder commented on GitHub (Jul 3, 2023):
@LGUG2Z Thanks to you for all the hard work on this!
@olivoil commented on GitHub (Jul 6, 2023):
Amazing, thank you @LGUG2Z!