Originally created by @maxbane on GitHub (Oct 21, 2022).
Describe the bug
When komorebi first starts up, the padding between windows (i.e. between each other) and between windows and monitor edges seems "too large" to me (I've configured smaller padding than default). komorebic retile causes the padding to shrink a lot (more like what I want), but this seems like a bug. Which padding is correct? Before the retile or after the retile?
See screencap video below for a demonstration.
To Reproduce
Snippet from my komorebi.ahk:
; Lower monitor
WorkspaceLayout(1, 0, "bsp")
WorkspacePadding(1, 0, 3)
ContainerPadding(1, 0, 5)
; Uncomment the next two lines if you want a visual border drawn around the focused window
ActiveWindowBorderColour(68, 71, 90, "single") ; Dracula "selection" color
My intention is for the padding between windows (and monitor edges) to be about the same as the thickness of the active window border. But I find that the configuration above gives different actual padding amounts depending on whether komorebi has just started up, or whether a retile or configuration-reload has occurred.
Expected behavior
The amount of padding should presumably be the same at start-up as after retile/reload.
OS Name: Microsoft Windows 10 Pro
OS Version: 10.0.19044 N/A Build 19044
Originally created by @maxbane on GitHub (Oct 21, 2022).
**Describe the bug**
When komorebi first starts up, the padding between windows (i.e. between each other) and between windows and monitor edges seems "too large" to me (I've configured smaller padding than default). `komorebic retile` causes the padding to shrink a lot (more like what I want), but this seems like a bug. Which padding is correct? Before the retile or after the retile?
See screencap video below for a demonstration.
**To Reproduce**
Snippet from my `komorebi.ahk`:
```
; Lower monitor
WorkspaceLayout(1, 0, "bsp")
WorkspacePadding(1, 0, 3)
ContainerPadding(1, 0, 5)
; Uncomment the next two lines if you want a visual border drawn around the focused window
ActiveWindowBorderColour(68, 71, 90, "single") ; Dracula "selection" color
```
My intention is for the padding between windows (and monitor edges) to be about the same as the thickness of the active window border. But I find that the configuration above gives different actual padding amounts depending on whether komorebi has just started up, or whether a retile or configuration-reload has occurred.
**Expected behavior**
The amount of padding should presumably be the same at start-up as after retile/reload.
**Screenshots and Videos**
Demonstration video: https://imgur.com/a/bPiQRjb
**Operating System**
```
OS Name: Microsoft Windows 10 Pro
OS Version: 10.0.19044 N/A Build 19044
```
adam
added the bug label 2026-01-05 14:48:35 +01:00
Definitely looks a little weird; can you try starting with the --await-configuration flag and see if the same behaviour persists? I have a feeling that the configuration option initially gets sent after the initial layout has taken place; with --await-configuration the first layout should not happen until all commands have been sent.
@LGUG2Z commented on GitHub (Oct 21, 2022):
Definitely looks a little weird; can you try starting with the [`--await-configuration` flag](https://github.com/LGUG2Z/komorebi#multiple-layout-changes-on-startup) and see if the same behaviour persists? I have a feeling that the configuration option initially gets sent after the initial layout has taken place; with `--await-configuration` the first layout should not happen until all commands have been sent.
Interesting, yeah, I think that's what's happening, but the fix is tricky. Even with --await-configuration the behavior would sometimes persist and sometimes not. I finally realized from the logs that it's because the order in which the configuration commands are processed is not deterministic, and not necessarily the order in which they appear in komorebi.ahk. I would often see that CompleteConfiguration got processed before ContainerPadding was processed, even though CompleteConfiguration is last in the config file.
It's because komorebic.lib.ahk uses Run for all of its komorebic.exe calls. This is asynchronous and doesn't guarantee that a sequence of calls will finish in a particular order... all of the komorebic.exe processes get forked in the background and run in parallel.
Replacing all the usages of Run with RunWait in komorebic.lib.ahk fixed the behavior, and it doesn't seem to be any slower.
Maybe consider generating komorebic.lib.ahk with RunWait instead of Run? I think it might be the only way to ensure that configuration commands get processed in their order of appearance in the config file, which is probably what the user expects.
@maxbane commented on GitHub (Oct 22, 2022):
Interesting, yeah, I think that's what's happening, but the fix is tricky. Even with `--await-configuration` the behavior would sometimes persist and sometimes not. I finally realized from the logs that it's because the order in which the configuration commands are processed is not deterministic, and not necessarily the order in which they appear in `komorebi.ahk`. I would often see that `CompleteConfiguration` got processed before `ContainerPadding` was processed, even though `CompleteConfiguration` is last in the config file.
It's because `komorebic.lib.ahk` uses `Run` for all of its `komorebic.exe` calls. This is asynchronous and doesn't guarantee that a sequence of calls will finish in a particular order... all of the `komorebic.exe` processes get forked in the background and run in parallel.
Replacing all the usages of `Run` with `RunWait` in `komorebic.lib.ahk` fixed the behavior, and it doesn't seem to be any slower.
Maybe consider generating `komorebic.lib.ahk` with `RunWait` instead of `Run`? I think it might be the only way to ensure that configuration commands get processed in their order of appearance in the config file, which is probably what the user expects.
Good catch, I didn't realise that Run was an async command. I've updated the library generation command and the example library and the generated file at the root of the repo. You should be able to run iwr https://raw.githubusercontent.com/LGUG2Z/komorebi/master/komorebic.lib.ahk -OutFile $Env:USERPROFILE\komorebic.lib.ahk to grab the latest and try again.
@LGUG2Z commented on GitHub (Oct 22, 2022):
Good catch, I didn't realise that `Run` was an async command. I've updated the library generation command and the example library and [the generated file at the root of the repo](https://github.com/LGUG2Z/komorebi/blob/1229c655808f0cd69e665f4778c3d9a178b947e2/komorebic.lib.ahk). You should be able to run `iwr https://raw.githubusercontent.com/LGUG2Z/komorebi/master/komorebic.lib.ahk -OutFile $Env:USERPROFILE\komorebic.lib.ahk` to grab the latest and try again.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @maxbane on GitHub (Oct 21, 2022).
Describe the bug
When komorebi first starts up, the padding between windows (i.e. between each other) and between windows and monitor edges seems "too large" to me (I've configured smaller padding than default).
komorebic retilecauses the padding to shrink a lot (more like what I want), but this seems like a bug. Which padding is correct? Before the retile or after the retile?See screencap video below for a demonstration.
To Reproduce
Snippet from my
komorebi.ahk:My intention is for the padding between windows (and monitor edges) to be about the same as the thickness of the active window border. But I find that the configuration above gives different actual padding amounts depending on whether komorebi has just started up, or whether a retile or configuration-reload has occurred.
Expected behavior
The amount of padding should presumably be the same at start-up as after retile/reload.
Screenshots and Videos
Demonstration video: https://imgur.com/a/bPiQRjb
Operating System
@LGUG2Z commented on GitHub (Oct 21, 2022):
Definitely looks a little weird; can you try starting with the
--await-configurationflag and see if the same behaviour persists? I have a feeling that the configuration option initially gets sent after the initial layout has taken place; with--await-configurationthe first layout should not happen until all commands have been sent.@maxbane commented on GitHub (Oct 22, 2022):
Interesting, yeah, I think that's what's happening, but the fix is tricky. Even with
--await-configurationthe behavior would sometimes persist and sometimes not. I finally realized from the logs that it's because the order in which the configuration commands are processed is not deterministic, and not necessarily the order in which they appear inkomorebi.ahk. I would often see thatCompleteConfigurationgot processed beforeContainerPaddingwas processed, even thoughCompleteConfigurationis last in the config file.It's because
komorebic.lib.ahkusesRunfor all of itskomorebic.execalls. This is asynchronous and doesn't guarantee that a sequence of calls will finish in a particular order... all of thekomorebic.exeprocesses get forked in the background and run in parallel.Replacing all the usages of
RunwithRunWaitinkomorebic.lib.ahkfixed the behavior, and it doesn't seem to be any slower.Maybe consider generating
komorebic.lib.ahkwithRunWaitinstead ofRun? I think it might be the only way to ensure that configuration commands get processed in their order of appearance in the config file, which is probably what the user expects.@LGUG2Z commented on GitHub (Oct 22, 2022):
Good catch, I didn't realise that
Runwas an async command. I've updated the library generation command and the example library and the generated file at the root of the repo. You should be able to runiwr https://raw.githubusercontent.com/LGUG2Z/komorebi/master/komorebic.lib.ahk -OutFile $Env:USERPROFILE\komorebic.lib.ahkto grab the latest and try again.@maxbane commented on GitHub (Oct 24, 2022):
Cool, thanks! I'll call this closed 👍🏻