Skip to content

Leave a later toggle alone when the tray icon's first toggle is disabled [patch] - #68

Merged
matt-edmondson merged 1 commit into
mainfrom
fix/67-tray-click-first-toggle-only
Nov 4, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
fix/67-tray-click-first-toggle-only

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #67

What changed

When the first toggle was disabled, TrayApplication.OnTrayIconClicked skipped it and flipped the next enabled toggle instead. The icon follows the first toggle by default (ActiveWhen → FirstToggleState). So a left click changed a setting the icon doesn't show, and onToggled saved that change when the toggle had a persistAs key.

The loop now stops at the first TrayToggleItem, whether or not it is enabled, and calls Activate only when IsEnabled is true. The <summary> and remarks now describe it as "the first toggle, or nothing" rather than "the first enabled toggle".

Tests

  • New test TrayIconClick_WithTheFirstToggleDisabled_LeavesTheSecondToggleAlone: two toggles with the first disabled. A click on the icon runs neither setter and never calls onToggled.
  • With the fix reverted, the test fails on Assert.AreEqual(0, secondSetterCalls). With the fix, it passes.
  • Full suite: 161 passed, 1 skipped, 0 failed (net10.0, Linux).

Generated by Claude Code

…led [patch]

The left-click shortcut skipped a disabled first toggle and flipped the next
enabled one instead. The icon follows the first toggle by default, so the click
changed (and, with persistAs, remembered) a setting the icon doesn't show. Stop
at the first toggle and activate it only when it is enabled.

Fixes #67

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017vfJW67k6oxx5vQPHu3V4Q
@sonarqubecloud

sonarqubecloud Bot commented Nov 1, 2026

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit e314988 into main Nov 4, 2026
14 checks passed
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.

Left-clicking the tray icon flips (and persists) the second toggle when the first one is disabled

2 participants