How do I turn off WLAN automatically when LAN is connected?

I think you might be making this harder than it has to be. I have the same situation with my laptop (except it's a normal ethernet port instead of a dock). When I plug in the wired network, it automatically takes precedence over the wireless and everything goes over the (faster) ethernet cord. The wireless was connected all along, but unused. When I unplug the cable it falls back to using the wireless connection.

So, have you tried to see if this does what you want already? I'm using nothing more than the standard network applet that comes with Ubuntu.


I'm also happily using a ThinkPad with a dock, but for me @Azendale's answer was not the case: after removing the laptop from the dock, internet connection would go down and required to reconnect WiFi to make it work.

So i googled up this solution and it works: https://superuser.com/a/367472/200497

As this question appears high in Google search results, i decided to share the link here.