Skip to content

fix(komorebi): start a bar that did not come back after a rebuild - #199

Merged
aguil merged 2 commits into
masterfrom
fix/komorebi-missing-bar
Nov 23, 2026
Merged

aguil merged 2 commits into
masterfrom
fix/komorebi-missing-bar

Conversation

@aguil

@aguil aguil commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

Fixes #193

Why the change

After a dock, a bar that exits during komorebi's rebuild leaves its monitor without bar spacing, and the recovery script then restarts all of komorebi (once per 10 minutes) when starting that one bar would do.

Special things to note

  • Tried on real docks. On 2026-11-22 at 21:17 and 21:20 the rebuild left bar 0 missing both times; the script started it, spacing was right 2 seconds later, and komorebi was not restarted. The first dock also reopened 2 minimized windows, which fix(komorebi): keep workspace labels on their monitors #192 had not yet seen on a real dock. Both times, though, the script waited out the full 20 second rebuild timeout first, about 17 seconds after bar 0 had exited. The second commit starts the bar as soon as komorebi answers again; that timing is not yet tried on a real dock.
  • No second bar for one display. komorebi does not answer while it stops and starts the bars, so once it answers they have all been started. On top of that, a bar is started only from 5 seconds after the rebuild, once two checks in a row find the same bar missing, only if fewer bars run than bar_configurations lists, and only if every running bar's config path is known. Otherwise the script falls back to a restart. komorebi stops bars by name before every rebuild, so a bar started this way is stopped and restarted with the others.
  • The tests are not in the repo. They are in local scenario scripts, as for fix(komorebi): keep workspace labels on their monitors #192: 14 new rebuild cases plus checks of path matching and command-line parsing, all passing in PowerShell 5.1 and 7.

Change outline

After a rebuild:

 rebuild monitors (komorebic replace-configuration)
 wait up to 20s, checking every 2s
   right -> done
+  only bar spacing wrong, 5s or more in, and the same configured bar has no
+  running komorebi-bar in two checks in a row (all running ones have a known config)
+    -> start those bars, keep waiting at least 15s more
-restart komorebi: "rebuild did not help: <why it started>"
+restart komorebi: "rebuild did not help: <why it started>; still <what is wrong now>"
-after restart: "still wrong after 120s"
+after restart: "still <what is wrong> after 120s"

Files:

 dot_config/
   workspace-recover.ps1      # Wait-Healthy returns what is still wrong;
+                             # Get-MissingBars, bar start after a rebuild
   workspace-window.ps1       # + Get-BarProcessConfigs (reads -c / --config), Start-Bar
   komorebi-setup-notes.md    # recovery steps include starting a missing bar

🤖 Generated with Claude Code

After a dock, komorebic replace-configuration starts the bars while it
holds komorebi's lock. A bar whose first state request is dropped exits,
so its monitor gets no bar spacing and the recovery script restarted
komorebi, which is allowed only once per 10 minutes.

Now, when bar spacing is the only thing still wrong after the rebuild
and a configured bar has no running process, the script starts that bar
and checks again. It restarts komorebi only if that does not help. The
log now says what was still wrong, not only why the rebuild started.

Refs #193

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aguil
aguil marked this pull request as ready for review November 23, 2026 04:19
@aguil
aguil marked this pull request as draft November 23, 2026 04:23
On two real docks the script waited out the full 20 second rebuild
timeout before starting bar 0, which had exited about 4 seconds into
the rebuild. That delayed putting the windows back by about 17 seconds.

komorebi does not answer while it stops and starts the bars, so once it
answers they have all been started. The script now checks for a missing
bar while it waits for the rebuild, from 5 seconds in, and starts it
once two checks in a row find the same bar missing.

Refs #193

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aguil
aguil marked this pull request as ready for review November 23, 2026 04:42
@aguil
aguil merged commit 2889028 into master Nov 23, 2026
1 check passed
@aguil
aguil deleted the fix/komorebi-missing-bar branch November 23, 2026 04:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

komorebi rebuild after a dock fails intermittently: bar 0 does not come back

1 participant