This script file will disable wifi once an ethernet cable is plugged in. It has been tested on various Debian & Mint distributions.
Create /etc/NetworkManager/dispatcher.d/99-wlan and add the following contents to it:
#!/bin/bash
wired_interfaces="en.*|eth.*"
if [[ "$1" =~ $wired_interfaces ]]; then
case "$2" in
up)
nmcli radio wifi off
;;
down)
nmcli radio wifi on
;;
esac
fi
Set the correct ownership and permissions:
chown root:root /etc/NetworkManager/dispatcher.d/99-wlan
chmod 755 /etc/NetworkManager/dispatcher.d/99-wlan
Created: 2024-02-03 | Modified: 2024-04-01 |