When using the airpods's microphone on a mac the sound quality gets worse, this is something that's not fixable at the moment and the best we can do is not use the airpods's microphone to get the best sound quality possible.
This script checks if the input device changes and if it does changes it back automatically to the input devices specified.
This script is not perfect, as it constantly checks the input devices instead of only doing so when there is in fact a new input device. If you can think of any improvements to be done please submit a pull request or contact me!