Skip to content

Windows Theme Switcher v2.1.2

Choose a tag to compare

@DashAkoul DashAkoul released this 27 Oct 16:38
· 3 commits to main since this release

v2.1.2 — second audit pass

A second review pass, focused on the updater path, lock contention, the IPC surface and CSS. Eight more findings, all fixed. Details in docs/AUDIT.md.

Fixed: a disk write on every theme switch

apply_profile_inner wrote last_active_profile into config.json on every apply — and called config.save() while holding the config mutex, so opening the panel could wait behind a tray click. The field itself was never read anywhere. It is gone (Rust struct, TS types, browser mock) along with the write. Configs from older versions that still contain it keep loading.

Fixed: autostart state could disagree with the registry

toggle_autostart_inner flipped the in-memory value before writing the Run key. If the registry write failed (policy, endpoint protection), the function returned an error but memory already claimed the new value — the mirror of the save_settings bug fixed in 2.1.1. It now reads, writes the registry, and only then updates memory.

Fixed: a click could be silently dropped

If a panel click raced a tray click, the second request returned the live state instead of being applied, so the UI showed the other click's result. apply_profile now waits up to 25 ms and retries once — short on purpose, because the callers run on the main thread.

Security: smaller IPC surface

The hide_panel command was never called from the UI (the ✕ button uses window.close()), and allow-hide / allow-show / allow-set-focus were unused as well — hide/show/set_focus only happen on the Rust side, which needs no JS permission. All four are removed.

CSS and cleanup

  • long error messages are clamped to two lines (the panel is a fixed height with no scrolling)
  • animations respect prefers-reduced-motion
  • dead html[data-theme] rules removed from boot.css (v2 never sets that attribute)
  • stale "340×246" comment corrected, unused ErrorCode variants removed

Verified on the release build

  • panel renders identically (same palette, 324 sampled colours)
  • light → dark → light in 1 ms
  • idle working set 148 KB
  • 37 unit tests pass, no compiler warnings, tsc clean