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
David JULIEN 4ee03b5cf5
Merge branch 'dev' into thesis
status: fix icons
        add sb-cpu
        fix sb-internet cat if non-existing iface
nvim: fix packer installation
        change packer icons
        change deprecated LSP installer
scripts: change default distro to Gentoo
zsh: set envvar in .zprofile
gnupg: update cache time
scipts: add oggconv
beets: add config
ncmpc: move config to ~/.config/.old
music: fix sb-mpdup startup
mpd: change instance check
2022-11-17 18:14:13 +01:00

29 lines
934 B
Bash
Executable File

#!/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 ssid and  icon if ethernet is connected.
ssid="$(wpa_cli status | grep -i ^ssid | sed -e 's/.*=//')"
state="$(wpa_cli status | grep -i ^wpa_state | sed -e 's/.*=//')"
case "$state" in
COMPLETED) str="$(printf " %s" $ssid)" ;;
INTERFACE_DISABLED) str="WIFI DOWN" ;;
*) str="$(printf "NO WIFI")";;
esac
eth="$(cat /sys/class/net/eth0/operstate &> /dev/null)"
if [ "up" = "$eth" ]; then
str="$(printf "%s / " "$str")"
fi
vpn="$(pidof openvpn)"
[ -n "$vpn" ] && str="$(printf "%s " "$str")"
printf " %s " "$str"