This repository has been archived on 2023-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/.local/bin/statusbar/sb-internet

25 lines
871 B
Plaintext
Raw Normal View History

#!/usr/bin/env sh
######################################################################
# @author : swytch (adapted from Luke Smith - lukesmith.xyz)
# @file : sb-internet
# @license : GPLv3
# @created : Saturday Feb 13, 2021 17:35:49 CET
#
# @description : internet block for dwmblocks
######################################################################
# Wifi quality percentage and  icon if ethernet is connected.
2021-09-07 23:44:05 +02:00
ssid="$(wpa_cli status | grep -i ^ssid | sed -e 's/.*=//')"
state="$(wpa_cli status | grep -i ^wpa_state | sed -e 's/.*=//')"
[ "COMPLETED" = $state ] && str="$(printf " %s" $ssid)" || str="$(printf " ---")"
2021-09-12 00:03:19 +02:00
eth="$(cat /sys/class/net/enp0s31f6/operstate)"
if [ "up" = "$eth" ]; then
2021-09-12 00:03:19 +02:00
str="$(printf "%s /  " "$str")"
fi
2021-04-09 11:20:27 +02:00
vpn="$(pidof openvpn)"
2021-09-12 00:03:19 +02:00
[ -n "$vpn" ] && str="$(printf "%s ()" "$str")"
2021-04-09 11:20:27 +02:00
printf " %s " "$str"