Skip to content

accent-picker: persist accent choice across restarts (ctx.storage + ctx.files + register-time restore) - #358

Closed
Icarus-B4 wants to merge 7 commits into
NousResearch:mainfrom
Icarus-B4:accent-picker-persist-v2
Closed

Icarus-B4 wants to merge 7 commits into
NousResearch:mainfrom
Icarus-B4:accent-picker-persist-v2

Conversation

@Icarus-B4

Copy link
Copy Markdown
Contributor

The Accent Picker shipped with setAccentOverride, which is deliberately scratch-only — the color resets on every launch. This PR makes the picker persist the chosen accent across restarts.

Changes:

src/plugin.tsx: restore the persisted accent at register() time (so it applies on startup, not only when the popover opens); pass ctx through to the trigger; remove the onDispose handler that cleared the override on unload (which previously clobbered the saved value); update description.
src/picker.tsx: accept ctx as a prop; persist via both ctx.storage (fast, sync) and ctx.files (disk, robust against Electron webview localStorage loss); restore on mount from both; switch from setAccentOverride to $accentOverride.set to avoid normalization drift.
desktop/plugin.js: rebuilt.
Persistence strategy: two-tier — ctx.storage for immediate sync reads, ctx.files (plugin data folder) as the durable disk layer. Restore runs at plugin load so the color is active before the UI renders.

Testing: manually verified accent survives a full Hermes restart and applies on startup without opening the picker.

@Icarus-B4
Icarus-B4 requested a review from teknium1 as a code owner November 9, 2026 09:20
…act, drop the fork patch script

- Every pick goes through setAccentOverride/normalizeHex; typed text that is
  not a colour no longer lands raw in $accentOverride or in storage.
- One persist() in register() writes ctx.storage at once and the data-folder
  copy once a drag settles (was a file write per pointer move).
- Disabling the plugin clears the live override again (the saved pick stays
  and comes back on re-enable), so no colour is stranded without a control.
- Remove patch/: its script rewrote the user's catalog entry to a personal
  fork and sha.
- plugin.yaml 1.1.0; README text no longer says the colour is never persisted.
@teknium1

Copy link
Copy Markdown
Contributor

Thank you @Icarus-B4! This landed on main through #446, which stacked the 34 reviewed official-plugin PRs on current main so their shared files (CHANGELOGs, versions, the README grid) conflicted only once. Your commits are kept with your authorship; this PR's tip is 3e5d075. To get it now: hermes plugins install NousResearch/hermes-official-plugins#<plugin> --force; hermes plugins update follows once the catalog pin moves (in progress).

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.

2 participants