The credit for most of the code belongs to others including https://gist.github.com/albertbori/1798d88a93175b9da00b
This program turns off WiFi when it detects a wired ethernet connection and turns on WiFi when the ethernet is unplugged.
Tested on Catalina
git clone https://github.com/Calvin-LL/toggleairport.git
cd toggleairport
./install.sh
to uninstall just do
./uninstall.sh
(or if the Catalina version didn't work for you)
git clone --branch pre_catalina https://github.com/Calvin-LL/toggleairport.git
cd toggleairport
./install.sh
to uninstall just do
./uninstall.sh
Do not run either of the scripts with sudo, if you do, notifications will not display.