you can write a script (python or bash or whatever you want) to detect if the ethernet has an IP address (indicates connection) then disable wifi via putting interface down or rf-kill)
sudo ifconfig -a (ip -a in stretch) to get network interfaces name (ens32,eth0,wlan0)
the script to detect if eth has IP address (therefore is connected to a wired network (bash script)
Code: Select all
if ifconfig eth0 | grep -q "inet 192.168.XXX.XXX" ; then #change 192.168.XXX.XXX to your IP address when connected to wired
echo "ETH connection is up"
#put code to disable wifi here
echo "ETH connection is down"
#put code to renable wlan and connect to some AP