Play sounds when devices connect/disconnect
This makes it easier to know if the speaker's volume is correctly set, if we connected properly, etc.
The "device-added" and "device-removed" in sound-theme-freedesktop are probably pretty good sounds to start with.
Using something similar to this script: https://github.com/adenbeckitt/Bluez-AVRCP-Volume-Control should work.
Connecting:
/org/bluez/hci0/dev_00_00_00_00_00_00: org.freedesktop.DBus.Properties.PropertiesChanged ('org.bluez.MediaControl1', {'Connected': <true>}, @as [])
<short pause>
/org/bluez/hci0/dev_00_00_00_00_00_00/fd1: org.freedesktop.DBus.Properties.PropertiesChanged ('org.bluez.MediaTransport1', {'State': <'active'>}, @as [])
Disconnecting:
/org/bluez/hci0/dev_00_00_00_00_00_00: org.freedesktop.DBus.Properties.PropertiesChanged ('org.bluez.MediaControl1', {'Connected': <false>}, @as [])
So, when Connected = true, we'd pause for about 0.5 sec, and play a sound if the State was anything but active. We'd always play a sound if Connected is false.
The freedesktop sound theme has pretty good sounds we could use to play back.
Note implemented exactly like the above. Note that we received a "Connected" signal even if the device was already connected, when we try to disconnect. The code also doesn't handle multiple devices being connected.