Give plugins the current bar configuration after shell.json changes - #11661
rgouveiamendes wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XZQ9FGgM8QFtDgpoQfcdtv
|
This seems reasonable. The only thing I'm wondering about is if it breaks any existing plug-ins and how do we find out or deal with that? |
|
It changes what plugins receive only while a
So a plugin behaves differently only if it relied on receiving the previous configuration after a change. To check existing plugins, I searched GitHub code (default branches that GitHub indexes, so not every plugin) for third-party use of
Each reads the current value; none compares old and new snapshots. I have only run boringday.wallpapers against the patch, not the other two. |
|
Reviewed at 5600622. The fix is correct, I reproduced the bug it fixes, and I found nothing to change. Reproduction, on a disposable Omarchy VM running the real shell. I installed a small third-party service plugin that records
The new expression in On whether it breaks existing plugins: plugins receive the same shape as before, through the same triggers. Only the value delivered while a Tests, on the same VM. Second opinion: Codex at medium effort reviewed the diff and found no production defect. It agreed the change is the smallest correct one and that no other reader delivers a stale value; independence from my own reasoning is not guaranteed. The point that the test checks text rather than behaviour is its finding. Related: this fixes #11505 and #11852, now linked so they close when it merges. #11578 makes the same change to Nothing is left for you to do. Whether it lands is the maintainer's decision. |
Problem
Third-party plugins read the bar section of
shell.jsonthrough their shell facade'sbarConfig.After
shell.jsonchanges, that snapshot holds the configuration from before the change.syncPluginApis()refreshes each facade'sbarConfigfrompublicBarConfig(), and it runs fromonShellConfigChanged(viapluginsChanged).publicBarConfig()copies thebarConfigbinding, which has not yet re-evaluated when that handler runs.So each change delivers the previous configuration, and a plugin that writes a setting through
updateEntryInlineand reads it back sees the old value until the next change.A plugin that merges its current settings before writing also reverts the setting it changed last.
Minimal reproduction of the ordering in Quickshell:
Change
publicBarConfig()copiesshellConfig.bardirectly (falling back tobuiltinShellConfig.bar, as the binding does).publicIdleConfigFor()already readsshellConfigthis way.A static assertion in
plugin-auth-boundary-test.shguards against reading the binding again.Testing
test/shell.d/plugin-auth-boundary-test.shpasses; the new assertion fails without the change../test/all: the remaining failures (bar-icon-geometry,config,snapper,unowned-system-paths) also fail onquattroat 93d9d0c on this machine; three need anomarchy-pkgscheckout.barConfigsaw eachupdateEntryInlinewrite on its next read, including writes 1 s apart. Without the patch it saw the previous write. Plugin used: boringday.wallpapers.🤖 Generated with Claude Code
https://claude.ai/code/session_01XZQ9FGgM8QFtDgpoQfcdtv
Fixes #11505
Fixes #11852