feat(networking): add wifi-auto-toggle dispatcher script
All checks were successful
Test / tests (push) Successful in 10m0s
All checks were successful
Test / tests (push) Successful in 10m0s
This commit is contained in:
parent
587134e555
commit
4a06b455b9
1 changed files with 21 additions and 0 deletions
|
@ -121,6 +121,27 @@ in
|
|||
];
|
||||
|
||||
networking.networkmanager.dispatcherScripts = [
|
||||
{
|
||||
source = pkgs.writeShellScript "wifi-auto-toggle" ''
|
||||
LOG_PREFIX="WiFi Auto-Toggle"
|
||||
|
||||
if [[ "$1" =~ ^(enp|eth) ]]; then
|
||||
case "$2" in
|
||||
up)
|
||||
echo "$LOG_PREFIX ethernet up"
|
||||
${pkgs.networkmanager}/bin/nmcli radio wifi off
|
||||
;;
|
||||
down)
|
||||
echo "$LOG_PREFIX ethernet down"
|
||||
${pkgs.networkmanager}/bin/nmcli radio wifi on
|
||||
;;
|
||||
esac
|
||||
elif [[ "$(${pkgs.networkmanager}/bin/nmcli -g GENERAL.STATE device show $ETHERNET_INTERFACE)" = "20 (unavailable)" ]]; then
|
||||
echo "$LOG_PREFIX failsafe"
|
||||
${pkgs.networkmanager}/bin/nmcli radio wifi on
|
||||
fi
|
||||
'';
|
||||
}
|
||||
{
|
||||
source = pkgs.writeShellScript "connect-ice" ''
|
||||
ACTION="$2"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue