Disconnect wireless lan when cable is active on Ubuntu Xenial (16.04)

If you wish to have your laptop wireless lan disconnected when you plug your Ethernet cable and re-activated after you unplug it:

Copy this script on your /etc/NetworkManager/dispatcher.d directory:

sudo cp autowlan /etc/NetworkManager/dispatcher.d

and make it executable with:

sudo chmod +x /etc/NetworkManager/dispatcher.d/autowlan

Installation of the above modification is entirely on your risk.