Repository navigation
Conversation
StateManager drops its state after 10 seconds without advertisements, and that also happens while the case lid stays open. The first state after such a gap had no previous state to compare with, so Manager counted it as a fresh lid opening every time and the battery popup came back every 10-60 seconds (SpriteOvO#233). LidTracker remembers the last lid state and when the device was lost. If the device comes back within 60 seconds, the new state is compared with that last state, so the lid only counts as opened when it was last seen closed or when the gap was longer. It is reset when the bound device's Bluetooth connection drops and when another device is bound. Closing the lid drops the connection before the closed lid is advertised, so without the reset a quick reopening would not show the popup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01StkifHpSLWH4J5TvuP56ur
This was referenced Oct 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the repeated popups in #233, the "lid-open event is being detected repeatedly" part Kashionz mentioned there. It doesn't add the setting to turn the popup off.
Cause
StateManagerdrops its state when no advertisement arrives for 10 seconds (_lostTimer). With the lid open and both pods in the case, that happens every 10–60 seconds on my machine, and the log shows the sameDevice is lost→UpdateStateloop as the log WolfCTOS posted. The first state after the gap has nooldState, soManager::OnStateChangeddidif (!oldState.has_value()) { lidStateSwitched = newLidOpened; }and every reappearance with the lid open counted as a fresh opening, which emitted
LidToggled(true)and showed the popup again.Change
A small
Details::LidTracker:SetOnDiscardStatecallback);TracksLidAcrossShortGapsinAirPodsDomainTestscovers these cases.How I tested it
Windows 11, AirPods Pro, a UGREEN BT 6.0 adapter, built locally with
--trace. I countedDevice is lostandMainWindow: Showin the log:The first version of this fix, without the reset on disconnect, failed the quick close and reopen case (
switched=false, no popup). That's why the reset is there.Also:
AirPodsDomainTests: 32/32 passed locally.Windowsworkflow on my fork passes: https://github.com/z1pp090/AirPodsDesktop/actions/runs/35902048442This doesn't touch the auto-hide or the popup logic that #238 changes, so the two shouldn't conflict.
🤖 Generated with Claude Code