summaryrefslogtreecommitdiff
path: root/etc/NetworkManager/dispatcher.d/70-wifi-wired-exclusive
blob: a0f0c4c83acb4cff7ac27d9fb4131d69fe261fe3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh

# https://wiki.archlinux.org/title/NetworkManager#Use_dispatcher_to_automatically_toggle_wireless_depending_on_LAN_cable_being_plugged_in

if [ "$1" = "enp3s0" ]; then
	case "$2" in
		up)
			nmcli radio wifi off
			;;
		down)
			nmcli radio wifi on
			;;
	esac
elif [ "$(nmcli -g GENERAL.STATE device show enp3s0)" = "20 (unavailable)" ]; then
	nmcli radio wifi on
fi