Skip to content

Leave the built-in off the bar when a second clone of it is disabled - #17563

Closed
ThePrimeagen wants to merge 1 commit into
omacom:quattrofrom
ThePrimeagen:fix/clock-clone-disable
Closed

ThePrimeagen wants to merge 1 commit into
omacom:quattrofrom
ThePrimeagen:fix/clock-clone-disable

Conversation

@ThePrimeagen

@ThePrimeagen ThePrimeagen commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

What changes

With two clones of the same built-in on the bar, such as your own from omarchy-plugin-clone omarchy.clock and one someone shared that you added with omarchy-plugin-add, disabling either one brings the built-in back beside the clone that stays: two clocks on the bar, or, for omarchy.menu, two menu buttons.

  • Disabling a clone always calls restoreCloneSource, which turns the clone's bar entry back into the built-in it was cloned from. Nothing checks whether another clone of that built-in is still on the bar standing in for it.
  • setEnabled now restores the built-in only when no other clone of it has a widget on the bar (barCloneFor). Otherwise it drops every record of the disabled clone, its bar entry and any plugins[] record, so it stops receiving the built-in's calls; and when the disabled clone was the one that switched a menu or panel built-in off (cloneSourceRestores), it hands that over to the clone that stays, so the built-in is switched back on when the last clone goes.
  • A clone that is only in plugins[], with its widget taken off the bar, does not count as standing in, so disabling the last clone on the bar still puts the built-in back in place.
  • omarchy-plugin-remove disables an enabled clone with the same setPluginEnabled <id> false call, so removing a clone goes through this path too (from the code; only disabling was run in the VM).

Steps

  1. omarchy-plugin-clone omarchy.menu. Your copy, <user>.menu, replaces omarchy.menu in place on the bar, and omarchy.menu is switched off (disabledPlugins). One menu button.
  2. Add a second clone, as if someone shared theirs:
    cp -r ~/.config/omarchy/plugins/<user>.menu /tmp/alice.menu && cd /tmp/alice.menu
    jq '.id = "alice.menu"' manifest.json > m.json && mv m.json manifest.json
    git init -q && git add . && git -c user.name=alice -c user.email=alice@example.com commit -qm menu && cd
    omarchy-plugin-add /tmp/alice.menu --enable --yes
    omarchy.menu is no longer on the bar to replace, so alice.menu goes into centerEnd. Two menu buttons, as expected.
  3. omarchy-plugin-disable <user>.menu.
    • On quattro: <user>.menu's entry is turned into omarchy.menu, so the bar still shows two menu buttons.
    • With this change: alice.menu is still on the bar, so <user>.menu is just taken off. One menu button.
  4. omarchy-plugin-disable alice.menu. omarchy.menu comes back in its place, switched on, and Super+Space opens it.

The same steps with omarchy.clock leave two clocks at step 3 on quattro, one with this change.

Verification

  • test/shell.d/plugin-registry-contract-test.sh gets one check, with two clones of a bar widget and two of a menu-and-widget built-in. Disabling the second widget clone leaves the first in the source's place with nothing beside it, and the last clone on the bar restores the source. Disabling the first menu clone while the second is on the bar (with the first also in plugins[]) takes it off the bar and out of plugins[], so calls to the built-in go to the second; disabling the second then brings the built-in back and switches it on.
    • On quattro 1d880868b it fails with the built-in beside the remaining clone: actual=[[{"id":"local.first-widget","size":4}],[{"id":"omarchy.first-widget"}],...,{"left":[{"id":"omarchy.hybrid"}],...}.
    • On this PR's first version it fails with the disabled clone still in plugins[] and still receiving the built-in's calls, and the built-in left switched off: {"left":[],"centerEnd":[{"id":"shared.hybrid"}],"plugins":[{"id":"local.hybrid"}],"receiver":"local.hybrid"},[{"id":"omarchy.hybrid"}],false].
    • It passes with this change.
  • plugin-registry-contract, plugin-clone, plugin-enable, plugin-manifest-scan, plugins, plugin-watcher-reap, runtime-smoke and manifest-entrypoints under test/shell.d/ pass, none skipped. qmllint reports nothing for PluginRegistry.qml, before or after.
  • Reproduced with an ISO built from quattro 1d880868b, then the same test run on an ISO built from 1d880868b plus this change: clone the clock, add a shared copy, disable the shared copy; clone the menu, add a shared copy, disable your copy, disable the shared copy, press Super+Space. After each command the test prints the widgets actually drawn on the bar (omarchy-shell shell debugBarGeometry) and disabledPlugins/cloneSourceRestores from shell.json.
    • quattro: two clocks drawn after disabling the shared clock (["prime.clock","omarchy.clock"]), and two menus drawn after disabling your menu (["alice.menu","omarchy.menu"]).
    • This branch: one clock (["prime.clock"]), one menu (["alice.menu"], with cloneSourceRestores now ["alice.menu"]), then ["omarchy.menu"] with disabledPlugins null, and Super+Space opens the Omarchy menu.
    • The same test on this PR's first version shows the review finding: after both menu clones are disabled no menu button is drawn ([]), omarchy.menu is still in disabledPlugins, and Super+Space opens nothing.
  • Same pattern: a path that takes a clone out of service without all of restoreCloneSource's cleanup (every bar and plugins[] record, and its cloneSourceRestores entry). Searched every caller of restoreCloneSource, every writer of cloneSourceRestores, disabledPlugins, plugins[] and bar.layout under shell/, and every bin/omarchy-plugin-*. Fixed here: the disable path of setEnabled for clones on the bar. Not affected: bar-kind clones (recorded only as bar.id) and omarchy-plugin-disable (goes through setEnabled). Left for Some ways a clone leaves skip its cleanup: its built-in stays switched off, or comes back beside another clone #17577, all on quattro today: two clones of an overlay, panel or service built-in (they live in plugins[], which barCloneFor does not count), dragging a menu clone off the bar, omarchy bar defaults, omarchy plugin remove of a widget clone that is off the bar, and a clone deleted by hand.
  • Related: Restore missing clone sources without retaining withdrawn claims #15482 also fixes this, as part of restoring sources whose clone manifest is missing, and waits on Reject unknown plugin disables #11134. This is a focused fix of the disable path alone.
  • Not fixed here: enabling the built-in itself while two of its clones are on the bar (omarchy-plugin-enable omarchy.clock) restores it in place of one clone and leaves the other beside it. That path picks a single clone (activeCloneFor), a different cause that needs its own fix.
  • Not checked: a clone with both a bar entry and a plugins[] record is covered by the test check only; the VM steps do not produce one.

Screenshots

Before (quattro 1d88086) After (this branch)
Shared clock disabled before clock after clock
Your menu disabled, shared one still on before menu after menu
This PR's first version After (this branch)
Last menu clone disabled, then Super+Space first version last menu after last menu

@greptile-apps

greptile-apps Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; both previously reported problems are fixed.

Summary

Disabling a clone now leaves the built-in off the bar while another clone still occupies it.

  • The built-in widget returns only after its last bar clone is disabled.

Both previous findings are fixed. No new actionable issues were found.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Disable a clone] --> B{Another clone on the bar?}
  B -->|Yes| C[Remove disabled clone's records]
  C --> D[Pass restore flag to remaining clone]
  B -->|No| E[Restore built-in]
Loading

Reviews (2) · Last reviewed commit: "Leave the built-in off the bar when a se..." · Reviewed by Greptile

Comment thread shell/services/PluginRegistry.qml Resolved
Comment thread shell/services/PluginRegistry.qml Resolved
Co-authored-by: Cursor <cursoragent@cursor.com>
@ThePrimeagen

Copy link
Copy Markdown
Contributor Author

Superseded by #17588, which fixes this case and every other way a clone leaves (#17577), by no longer storing that a built-in is replaced.

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.

1 participant