-
-
Save mika/cf280c78432e3b3479dc77e9d9a0774e to your computer and use it in GitHub Desktop.
Script should be placed under `/etc/NetworkManager/dispatcher.d/` with a name like `99-disable-wireless-when-wired`. Make sure 1) root owns it 2) it's mod is 755
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
IFACE=$1 | |
ACTION=$2 | |
ntfy () { | |
sudo -u cengiz \ | |
DISPLAY=:0 \ | |
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus \ | |
notify-send "$1" "$2" | |
} | |
case ${IFACE} in | |
eth*|usb*|en*) | |
case ${ACTION} in | |
up) | |
ntfy "Ethernet connected" "Disabling Wifi" | |
nmcli radio wifi off | |
;; | |
down) | |
ntfy "Ethernet disconnected" "Enabling Wifi" | |
nmcli radio wifi on | |
;; | |
esac | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment