27 lines
432 B
Shell
Executable file
27 lines
432 B
Shell
Executable file
#!/bin/sh
|
|
|
|
# Toggle the WiFi on or off
|
|
|
|
set -eu
|
|
|
|
|
|
_notify() {
|
|
command -v notify-send >/dev/null 2>&1 || return 0
|
|
notify-send 'WiFi' "$1"
|
|
}
|
|
|
|
|
|
case "$(nmcli -t radio wifi)" in
|
|
enabled)
|
|
nmcli radio wifi off
|
|
_notify 'Radio turned off'
|
|
;;
|
|
disabled)
|
|
nmcli radio wifi on
|
|
_notify 'Radio turned on'
|
|
;;
|
|
*)
|
|
_notify 'No radio available'
|
|
exit 1
|
|
;;
|
|
esac
|