19 lines
441 B
Bash
19 lines
441 B
Bash
#!/usr/bin/env bash
|
|
# rfkill everything (wifi + bluetooth); "active" means the wifi is soft-blocked.
|
|
active() { rfkill list wifi 2>/dev/null | grep -q "Soft blocked: yes"; }
|
|
|
|
case ${1:-} in
|
|
status) active && echo true || echo false ;;
|
|
*)
|
|
if active; then
|
|
rfkill unblock all
|
|
state=false
|
|
else
|
|
rfkill block all
|
|
state=true
|
|
fi
|
|
eww update airplane-mode="$state" 2>/dev/null
|
|
echo "$state"
|
|
;;
|
|
esac
|