Last active
April 4, 2019 00:27
-
-
Save varqox/74c63347d47c135545039dcfff9b0fb5 to your computer and use it in GitHub Desktop.
Network Manager enable wifi on ethernet (LAN) disconnect and disable it on ethernet (LAN) connect, works with openvpn (VPN) and disconnecting cable when laptop is suspended
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 | |
# Place in file: /etc/NetworkManager/dispatcher.d/pre-up.d/wlan_auto_block.sh | |
# Make the file safe for execution: sudo chmod 744 /etc/NetworkManager/dispatcher.d/pre-up.d/wlan_auto_block.sh | |
if [ "$1" = "enp3s0" ]; then | |
rfkill block wifi # rfkill is used for unblocking, so we have to use it for blocking | |
fi |
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 | |
# Place in file: /etc/NetworkManager/dispatcher.d/wlan_auto_unblock.sh | |
# Make the file safe for execution: sudo chmod 744 /etc/NetworkManager/dispatcher.d/wlan_auto_unblock.sh | |
if [ "$1" = "enp3s0" ]; then | |
if [ "$2" = "down" ]; then | |
rfkill unblock wifi # nmcli radio wifi on does not work during suspending | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment