Skip to content

Move setCenterHoverRevealSuppressed into Panel base to protect cloned plugins - #14047

Open
omarchybot wants to merge 3 commits into
quattrofrom
omabot/pr-11055
Open

omarchybot wants to merge 3 commits into
quattrofrom
omabot/pr-11055

Conversation

@omarchybot

Copy link
Copy Markdown
Collaborator

What was wrong

In 4.0.0 through 4.0.2 the clock and weather panels defined a local setCenterHoverRevealSuppressed() that wrote root.bar.centerHoverRevealSuppressed directly. Since 1702cf0 (shipped in 4.0.3), a bar widget that is not first-party gets a PluginBarApi whose centerHoverRevealSuppressed is read-only. A clone made with omarchy plugin clone omarchy.clock or omarchy.weather is a static, non-first-party copy, so a clone made before 4.0.3 still carries the old helper. Every open and close now throws TypeError: Cannot assign to read-only property "centerHoverRevealSuppressed", and because close() calls the helper before controller.hide(), the panel cannot be closed: it stays open over the desktop until the shell is restarted.

The fix

  • shell/Ui/Panel.qml gains setCenterHoverRevealSuppressed(), 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.sh removes the old override from existing clock and weather clones, identified by .omarchy.clonedFrom in 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.

Klebiano and others added 3 commits September 9, 2026 19:14
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>
@greptile-apps

greptile-apps Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium risk] Moves panel hover-reveal logic into base class.

The PR appears safe to merge, with non-blocking improvements needed for migration feedback and regression coverage.

Findings

  1. P2 Skipped clones go unreported ▶
  2. P2 QML rewrite lacks regression tests ▶

Summary

The PR moves hover-reveal suppression into the shared Panel base and adds a migration to remove incompatible overrides from older clock and weather clones.

  • The inherited helper delegates to the bar setter for both first-party panels and cloned plugins.
  • The migration preserves edited overrides, but does not identify ones that still contain the incompatible write.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Clock or weather panel] --> B{Local override remains?}
  B -->|No| C[Shared Panel helper]
  C --> D[Bar setter or PluginBarApi setter]
  B -->|Yes| E[Local helper]
  F[Migration] -->|Exact historical match| C
  F -->|Edited helper preserved| E
Loading

Reviews (1) · Last reviewed commit: "Strip only the stock legacy override in ..."

Comment thread migrations/1788986100.sh
Comment on lines +47 to +48
if cmp -s "$backup" "$qml_file"; then
rm -f "$backup"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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

Comment thread migrations/1788986100.sh
Comment on lines +43 to +45
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"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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!

@jandrusk

jandrusk commented Oct 6, 2026

Copy link
Copy Markdown

Looks right to me. I checked the migration's pattern against shell/plugins/panels/clock/Panel.qml at v4.0.2, and the stock helper matches exactly. For the maintainers: #11080 ("Fix PluginBarApi hover-reveal writes so cloned panels can close") is still open and fixes the same symptom (#10999, #11662) from the PluginBarApi side. Pick one, or confirm they're complementary.

Nit: removing the function from clock/Panel.qml leaves two blank lines before function refresh().

@omarchybot

Copy link
Copy Markdown
Collaborator Author

Reviewed against current quattro (c582e1d). The bug is real and still there: shell/Ui/PluginBarApi.qml:28 keeps centerHoverRevealSuppressed readonly, so a panel written against 4.0.0–4.0.2 throws on root.bar.centerHoverRevealSuppressed = value at the top of close() and never reaches controller.hide(). This pull request is the right fix for clock and weather clones, but there are competing fixes that cover more, so I recommend one of those instead. Nothing ran on a worker: verifying a fix that should not land would spend a worker on nothing.

What checks out. The migration's pattern matches the stock helper exactly in clock/Panel.qml at v4.0.0 (lines 117–120) and v4.0.2 (121–124), and in weather/Panel.qml at both (65–68). Clones resolve import qs.Ui to the running shell, so once the stock override is gone they inherit the new Panel.setCenterHoverRevealSuppressed(). I checked this by reading the code.

What it misses. The repair happens only through the migration, and the migration only touches manifests whose .omarchy.clonedFrom is omarchy.clock or omarchy.weather (migrations/1788986100.sh:31-32), whose helper still matches the stock text exactly. A third-party plugin that copied the old template still throws, and so does a clone whose helper the user has edited, because PluginBarApi stays readonly. Those are the plugins reported in #10999 (eduardodallecort.weather-radar, grokbar) and #11662 (io.github.calebhat.weather, OmaniClean, OmarGram).

The competing fixes. #11080 and #15012 both make PluginBarApi.centerHoverRevealSuppressed writable and forward the write to the bar. That fixes every plugin that writes the old property, whatever it was copied from, and edits no files in the user's config. This pull request, which carries #11055 forward, is the oldest of the three. It still loses to them under the oldest-wins default, because it misses the cases above. It has nothing those fixes need: moving the helper into the Panel base is a tidy-up and is not needed once the property is writable. As for which of #11080 and #15012 should land: #11080 restores its binding only from the property's change handler (shell/Ui/PluginBarApi.qml:52-59 at its head). An assignment that does not change the value, such as false while already false, drops the binding without firing that handler, so the plugin's copy of the flag stops following the bar. #15012 copies the value across in two separate change handlers, so it does not have that problem. #11080 does carry one improvement that #15012 lacks: clock and weather hide before they release the flag. Both are reviewed as items of their own.

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.

@aholbreich

Copy link
Copy Markdown
Contributor

Thanks for carrying #11055 and keeping edited clones out of the migration. After #18524, the original guarded clone reaches hide() without rewriting its files; I checked the old helper against 4.6.0-rc1. Could we close this for quattro? A 4.5 maintenance fix would be a separate decision.

@omarchybot

Copy link
Copy Markdown
Collaborator Author

On quattro (95a1c34752), #18524 removed centerHoverRevealSuppressed from PluginBarApi. The stock clock and weather clones from 4.0.0–4.0.2 check for that property before assigning it, so they skip the write and reach controller.hide() with their QML intact.

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 quattro. The second review's independence is not guaranteed. No worker tests ran. I recommend closing this PR for quattro and leave that decision with the maintainer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants