2023-09-13 15:36:52 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
radio_status () {
|
|
|
|
radio_status=$(nmcli radio wifi)
|
|
|
|
if [[ $radio_status == "enabled" ]]; then
|
|
|
|
echo "on"
|
|
|
|
else
|
|
|
|
echo "off"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
if [[ $1 == "toggle-radio" ]]; then
|
|
|
|
stat=$(radio_status)
|
|
|
|
if [[ $stat == "on" ]]; then
|
|
|
|
nmcli radio wifi off
|
|
|
|
else
|
|
|
|
nmcli radio wifi on
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2023-09-26 11:46:03 -04:00
|
|
|
FILE='/home/matt/.config/.bluetooth'
|
2023-09-13 15:36:52 -04:00
|
|
|
get_state() {
|
|
|
|
if [[ "$(rfkill list | grep -A 1 hci0 | grep -o no)" == "no" ]]; then
|
|
|
|
echo " " > "$FILE"
|
|
|
|
else
|
|
|
|
echo " " > "$FILE"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
if [[ "$1" == "blue-toggle" ]]; then
|
|
|
|
rfkill toggle bluetooth
|
|
|
|
get_state
|
|
|
|
fi
|