jrouleau / bluetooth-autoconnect

A linux command line tool to automatically connect to all paired and trusted bluetooth devices.
MIT License
212 stars 42 forks source link

Bluetooth Auto-Connect Issue After Unlocking Session from Sleep Mode #22

Closed rayandu924 closed 1 month ago

rayandu924 commented 2 months ago

Hello,

I've encountered an issue with the script that automatically connects Bluetooth devices on Linux startup. While the script works perfectly upon booting the system, it does not function correctly when unlocking a session after the computer has been put to sleep.

In my experience, my Bluetooth devices disconnect when the PC enters sleep mode. Upon waking the PC and unlocking the session, the script does not reconnect these Bluetooth devices as expected.

To address this issue, I've created a fork of the repository that includes a fix to ensure Bluetooth devices automatically reconnect after waking up from sleep and unlocking the session. You can find my fork here: https://github.com/rayandu924/bluetooth-autoconnect-handle-sleep-mode/tree/master

Please let me know if you'd like more details or if there's anything else I can provide to help resolve this issue.

Thank you!

jrouleau commented 1 month ago

Thank you for raising this.

See https://github.com/jrouleau/bluetooth-autoconnect/issues/13 for another solution. Powering down the adaptor before sleeping also has an added benefit of notifying and disconnecting from devices rather than just disappearing (though YMMV as you don't seem to be having an issue with that). We should probably add this as a service to the package though instead of burying it in a closed issue.

A locked session should have no impact as the bluetooth service (and user-specific audio service in the case of headphones/speakers) would already be running