What you are talking about requires two things that have issues:
- Auto reconnection requires sysmodule, not overlay
- Disaling/Enabling bluetooth requires access to service that has very few sessions and would easily conflict with MissionControl. Introducing such thing would definitely increase amount of worthless issue reports in MissionControl repository. Discussed this topic with ndeadly and came to the conclusion that it's not worth it.
As for simple Bluetooth audio overlay, it already exists
https://github.com/masagrator/BT_Audio-ovl
So you can use that as base for sysmodule.
What needs to be done:
- On start reconnect with last audio device
- In loop:
- use pdmqry to check when Switch just woke up from sleep mode (PowerStateChange play event type)
- Check if bluetooth is enabled with setsys and if it is, use btdrv to send request for audio connection with last device.