Last active
August 31, 2021 15:22
-
-
Save ethernetdan/63caa3a0b46c391ed93c938da27de745 to your computer and use it in GitHub Desktop.
Disables the WiFi device when the computer is docked and reenables it when it's undocked.
This file contains 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 | |
# This script disables the WiFi device when the computer is docked and | |
# reenables it when it's undocked. | |
DOCK_DEVICE="enp0s31f6" | |
if [ "$1" != "$DOCK_DEVICE" ]; then | |
exit 0 | |
fi | |
case "$2" in | |
up) | |
/usr/bin/nmcli radio wifi off | |
;; | |
down) | |
/usr/bin/nmcli radio wifi on | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Should be placed in
/etc/NetworkManager/dispatcher.d/20-wifi-dock-toggle.sh
in an executable file owned byroot
and must have write permission only for owner