Skip to content

fix(menu): check mark for layer targets of toggle_layer_render - #214

Merged
CodeZeno merged 1 commit into
CodeZeno:mainfrom
bsmely:fix/layer-toggle-check-mark
Nov 11, 2026
Merged

CodeZeno merged 1 commit into
CodeZeno:mainfrom
bsmely:fix/layer-toggle-check-mark

Conversation

@bsmely

@bsmely bsmely commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • A context-menu row whose toggle_layer_render target is a layer never showed a check mark, even while that layer was drawing. context_menu_action_flags resolved the target against theme.surfaces only, so checked stayed false for every layer target.
  • The action itself resolves the target differently: execute_context_menu_action runs toggle("<target>", render) through execute_mouse_action_source in the surface the menu was opened from, where layers do resolve. So the row toggled the layer correctly but reported no state back.
  • Resolve the flag the same way the action does: a surface id first, keeping the existing behaviour, otherwise a layer in the origin surface, reporting its live render state. An id that matches neither reports no state and stays unchecked instead of guessing.
  • The lookup moved into toggle_layer_render_state so it can be covered without window state. No behaviour change for toggle_provider, toggle_widget, or surface targets.

To reproduce before the fix: give a theme a menu row with {"type": "toggle_layer_render", "target": "<layer id>"}. Clicking it shows and hides the layer, but the row is never checked, unlike a toggle_provider row.

Testing

Windows 11, Rust 1.95.0 (MSVC), release profile:

  • cargo fmt --all -- --check — clean.
  • cargo build --locked --release — success.
  • cargo test --locked --release — 619 passed, 0 failed, 6 ignored.
  • New regression test window::window_context_menu::tests::a_layer_toggle_row_reports_the_layer_state_a_surface_row_already_reported: a surface id still reports the surface, a visible layer id now reports Some(true), the same layer with render = 0 reports Some(false), and an unknown id reports None. It uses ThemeDocument::starter() and no credentials or live provider requests.
  • Manual check in the taskbar widget on Windows 11, with a theme whose menu rows target the two layers of a split Claude block: both rows now show a check mark while their layer draws, hiding a layer clears its check mark, and the toggle_provider row next to them is unaffected.

Checklist

  • I have read CONTRIBUTING.md and CODE_OF_CONDUCT.md.
  • The change is focused and contains no credentials or sensitive data.
  • I have added or updated relevant documentation and tests, where applicable.
  • I have left changelog and version changes to maintainers unless requested.

🤖 Generated with Claude Code

The flag lookup matched surface ids only, so a row toggling a layer
stayed unchecked even while that layer was drawing. Resolve the target
in the surface the menu was opened from, which is where the action
itself toggles it, and report that layer live render state.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
CodeZeno added a commit that referenced this pull request Nov 11, 2026
Fix layer-toggle check marks and avoid nested state locking in menus; preserve PR #214 author credit.
@CodeZeno
CodeZeno merged commit f88c851 into CodeZeno:main Nov 11, 2026
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