Repository navigation
Move setCenterHoverRevealSuppressed into Panel base to protect cloned plugins - #14047
omarchybot wants to merge 3 commits into
Conversation
PluginBarApi made centerHoverRevealSuppressed readonly in 4.0.3 and added a public setCenterHoverRevealSuppressed() function as the replacement. The clock and weather panels were updated to call the function, but any user-cloned copy of those panels kept the old direct-write pattern and now fires a TypeError in a tight loop whenever the panel is opened or closed, stalling the event loop. Move the correct implementation into the Panel base (qs.Ui/Panel.qml) so every panel — including clones already on disk — inherits it without needing to copy the pattern. Remove the now-redundant local overrides from the clock and weather panels. Add a migration that safely strips the broken local override from any cloned clock or weather panel still carrying it, with backups and nested-block safety. Fixes: TypeError spam loop on cloned panel open/close after 4.0.3 Reported-by: Klebiano <klebs@omarchy.local>
Migrations run under bash -euo pipefail, so a jq failure on any malformed manifest.json under ~/.config/omarchy/plugins exited the migration with status 5, leaving it pending and holding back every later migration. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The balanced-brace regex removed any setCenterHoverRevealSuppressed function in a clock or weather clone, whatever it contained. A user who had edited that function lost their changes, and a brace inside a string or comment ended the match early and left invalid QML that the post-check then accepted. A stray typeof mention elsewhere in the file skipped the repair, and an unrelated assignment-like line reverted it, with the migration still marked complete either way. Match the 4.0.0-4.0.2 function exactly instead, so only the stock override is removed and an edited one is left as it is. Whether the file changed decides the outcome, and a backup is kept only when it did. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Codex Medium <noreply@openai.com>
|
| if cmp -s "$backup" "$qml_file"; then | ||
| rm -f "$backup" |
There was a problem hiding this comment.
Skipped clones go unreported If a clone's helper was edited but still contains the incompatible property write, the exact replacement leaves it unchanged. This branch removes the backup, and the migration reports that no clone needed patching before it is marked complete. The user gets no indication that the panel may still fail to close. Preserve the edited code, but report clones that still need a manual repair.
Knowledge Base Used: Migration framework
| perl -0777 -i -pe ' | ||
| s{(?:\n[ \t]*//[^\n]*)*\n[ \t]*function setCenterHoverRevealSuppressed\(value\) \{\n[ \t]*if \(root\.bar && "centerHoverRevealSuppressed" in root\.bar\)\n[ \t]*root\.bar\.centerHoverRevealSuppressed = value\n[ \t]*\}(?=\n)}{}g; | ||
| ' "$qml_file" |
There was a problem hiding this comment.
QML rewrite lacks regression tests This exact-match rewrite changes user-owned QML, but there is no test for a historical clone, an edited override, or a second run. A later change to the match could silently leave a panel broken or alter user code. Add fixture-based checks for what the migration patches, preserves, and backs up.
Knowledge Base Used: Migration framework
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
Looks right to me. I checked the migration's pattern against Nit: removing the function from |
|
Reviewed against current What checks out. The migration's pattern matches the stock helper exactly in What it misses. The repair happens only through the migration, and the migration only touches manifests whose The competing fixes. #11080 and #15012 both make Second opinion: Codex at medium effort compared the three without my answer. It reached the same conclusion about this pull request and raised the #11080 binding issue, which I then checked against the code. Its independence is not guaranteed. Waiting on the maintainer to choose among #14047, #11080 and #15012. My recommendation is to close this one in favour of the API-side fix. |
|
On Codex High checked the historical helpers and current source. Opus 5.5 High agreed and pointed out that the migration would make rewritten clones depend on a new helper that has no effect on |
What was wrong
In 4.0.0 through 4.0.2 the clock and weather panels defined a local
setCenterHoverRevealSuppressed()that wroteroot.bar.centerHoverRevealSuppresseddirectly. Since 1702cf0 (shipped in 4.0.3), a bar widget that is not first-party gets aPluginBarApiwhosecenterHoverRevealSuppressedis read-only. A clone made withomarchy plugin clone omarchy.clockoromarchy.weatheris a static, non-first-party copy, so a clone made before 4.0.3 still carries the old helper. Every open and close now throwsTypeError: Cannot assign to read-only property "centerHoverRevealSuppressed", and becauseclose()calls the helper beforecontroller.hide(), the panel cannot be closed: it stays open over the desktop until the shell is restarted.The fix
shell/Ui/Panel.qmlgainssetCenterHoverRevealSuppressed(), delegating to the bar's setter, and the clock and weather panels drop their copies and inherit it. A clone always uses the base from the running build, so this one stops depending on what was on disk when it was cloned.migrations/1788986100.shremoves the old override from existing clock and weather clones, identified by.omarchy.clonedFromin their manifests, so they inherit the base helper. A clone's own function overrides the base, so the migration is what repairs installed clones. It matches the stock 4.0.0–4.0.2 function exactly, so a clone whose helper the user has edited is left untouched. It keeps a backup of every file it changes, skips manifests it cannot parse instead of aborting the migration queue, and does nothing on a second run.Possibly related: #11105 reports a cloned clock on 4.0.3 whose calendar stays open, which is this symptom. That report says the clone matches stock, so it is not linked as closed.
Supersedes #11055 by @Klebiano, whose commits this carries unchanged, with the fixes above on top.