linux: clean up tray state when airpods disconnect during hibernation#553
Open
xxmathias wants to merge 1 commit intokavishdevar:mainfrom
Open
linux: clean up tray state when airpods disconnect during hibernation#553xxmathias wants to merge 1 commit intokavishdevar:mainfrom
xxmathias wants to merge 1 commit intokavishdevar:mainfrom
Conversation
After waking from hibernation, the L2CAP socket state can be stale and BlueZ may have already torn down the connection without us seeing the disconnect signal — leaving the tray stuck on the last battery percentage even though the device is gone. Replace the socket-state check with a deferred BlueZ query (the SNI 'Connected' property may not have settled yet at PrepareForSleep(false) time), and route a stale-but-disconnected device through the normal onDeviceDisconnected path so the tray icon and DeviceInfo are reset. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
The new Rust port is where this project is heading long-term, and I think that's a great direction. That said, I'm still using the Qt/C++ build day-to-day - it's the version I've come to rely on and personally prefer, so I'd love to keep it polished while the rewrite matures. Hope a small fix here is still welcome!
After waking from hibernation, the Linux app would leave the tray icon
stuck on the last battery percentage even when the AirPods were no longer
connected. The L2CAP socket state used by
onSystemWakingUpis staleacross hibernation, and BlueZ may have torn down the connection without
the app seeing the
PropertiesChangedsignal.What this PR does:
areAirpodsConnected()check with a deferredBlueZ query (
monitor->checkAlreadyConnectedDevices()), which isauthoritative.
QTimer::singleShotso BlueZ'sConnectedproperty has time to settle afterPrepareForSleep(false)and any pending
bluezDeviceDisconnectedsignal can run the normalcleanup path first.
onDeviceDisconnected,which resets
DeviceInfoand the tray icon.Test plan
disconnect during sleep, then resume — tray icon resets to default,
no stale battery %.
resume — A2DP profile is re-activated, tray keeps showing battery
status, no false disconnect.