When the microphone is turned off and the Bluetooth headset is plugged in, the system turns the microphone on and the icon changes from off to on correctly.
When the headphones are disconnected, the system restores the previous state of the microphone and turns it off, but the icon on the panel doesn't change. In this case, the microphone is in the off state and if you click on the icon, the microphone will turn on and the icon will change from on to on :). If you press again, the icon changes to off, and the microphone are off again.
Thus, it is necessary to add some background tracking of the microphone status and change the icon, or monitor the headset on/off events, if it is functionally possible.
When the microphone is turned off and the Bluetooth headset is plugged in, the system turns the microphone on and the icon changes from off to on correctly.
When the headphones are disconnected, the system restores the previous state of the microphone and turns it off, but the icon on the panel doesn't change. In this case, the microphone is in the off state and if you click on the icon, the microphone will turn on and the icon will change from on to on :). If you press again, the icon changes to off, and the microphone are off again.
Thus, it is necessary to add some background tracking of the microphone status and change the icon, or monitor the headset on/off events, if it is functionally possible.