2024-04-28 23:26:31 -07:00
|
|
|
#!/usr/bin/env zsh
|
|
|
|
|
|
2025-10-09 22:40:38 -07:00
|
|
|
let bluetooth=1
|
|
|
|
|
if [[ "${1}" == '--no-bluetooth' ]] || [[ "${1}" == '-n' ]]; then
|
|
|
|
|
bluetooth=0
|
|
|
|
|
fi
|
|
|
|
|
|
2024-04-28 23:26:31 -07:00
|
|
|
if [[ "$(uname)" = 'Linux' ]]; then
|
2025-06-13 22:33:27 +09:00
|
|
|
local active_networks="$(nmcli --fields type c s --active)"
|
2024-04-28 23:26:31 -07:00
|
|
|
local output=''
|
2025-06-13 22:33:27 +09:00
|
|
|
[[ "${active_networks}" = *'wifi'* ]] && output="${output} "
|
|
|
|
|
[[ "${active_networks}" = *'ethernet'* ]] && output="${output}"
|
|
|
|
|
[[ "${active_networks}" = *'wireguard'* ]] && output="${output} "
|
2024-04-28 23:26:31 -07:00
|
|
|
(( ${#output} == 0 )) && output=''
|
2025-10-09 22:40:38 -07:00
|
|
|
if (( bluetooth )); then
|
|
|
|
|
bluetoothctl show | grep 'Powered: yes' >/dev/null && output="${output} "
|
|
|
|
|
fi
|
2024-04-28 23:26:31 -07:00
|
|
|
printf '%s\n' "${output}"
|
|
|
|
|
else
|
|
|
|
|
echo "${0}: error: unknown os: \"$(uname)\"" >&2
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|