The credit for most of the code belongs to others including albertbori/toggleairpot forked from Calvin-LL/toggleairport
Simply this Script turns off the WiFi Adapter when it detects a Wired Ethernet Connection and turns the WiFi back on when the Ethernet Adapter is unplugged. Only for MacOs.
To Install
mkdir -p $HOME/.config/scripts/ && cd $HOME/.config/scripts/
git clone https://github.com/earendildev/toggleairport.git
cd toggleairport
./install.sh
To Uninstall
cd $HOME/.config/scripts/toggleairport
./uninstall.sh
Do not run either of the scripts with sudo, if you do, notifications will not display.