Files
nixconfig/modules/home/wayland/apps/eww/bar/scripts/airplane-mode
T
2026-09-11 22:40:11 +02:00

20 lines
462 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 ;;
*)
detach_self "$@"
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