improve eww
This commit is contained in:
@@ -1,19 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
is_active() {
|
||||
rfkill list wifi 2>/dev/null | grep -q "Soft blocked: yes"
|
||||
}
|
||||
# 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)
|
||||
is_active && echo true || echo false
|
||||
;;
|
||||
case ${1:-} in
|
||||
status) active && echo true || echo false ;;
|
||||
*)
|
||||
if is_active; then
|
||||
if active; then
|
||||
rfkill unblock all
|
||||
echo false
|
||||
state=false
|
||||
else
|
||||
rfkill block all
|
||||
echo true
|
||||
state=true
|
||||
fi
|
||||
eww update airplane-mode="$state" 2>/dev/null
|
||||
echo "$state"
|
||||
;;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user