plugfiles

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 56a580234946e7ad4b2bd45a0991ac34a40a2a28
parent 62d1fe09d6b380ac08318fb7919331ffd7d26f54
Author: NicholasFarrow <nicholas.w.farrow@gmail.com>
Date:   Wed,  5 Jun 2019 17:50:43 +1000

nordvpn i3status

Diffstat:
M.config/i3/statusbar.sh | 26++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/.config/i3/statusbar.sh b/.config/i3/statusbar.sh @@ -6,16 +6,30 @@ crypto_rate () { echo "$(curl -s rate.sx | grep $1 | sed -n ${ln}p | grep -Eo "[0-9]*\.[0-9]*" | head -1)" } +nordvpn_status () { + STATUS=$(nordvpn status) + CONNSTAT=$(grep "Status:" <<< "$STATUS" | cut -d ' ' -f2) + COUNTRY=$(grep "City:" <<< "$STATUS" | cut -d ' ' -f2) + IP=$(grep "IP" <<< "$STATUS" | cut -d ':' -f2) + echo "$CONNSTAT $COUNTRY$IP" +} + + i3status | while : do + # Save output of i3status (generic time date space info) to $line read line - #echo $line + + # Get NordVPN status + if command -v nordvpn &> /dev/null; then + NORD=$(nordvpn_status) + else + NORD="" + fi + BTC=$(crypto_rate "BTC") ETH=$(crypto_rate "ETH") - RATIO=$(bc <<< "scale=6;$ETH/$BTC") + RATIO=$(bc <<< "scale=5;$ETH/$BTC") - #echo "BTC:$BTC ETH:$ETH ETH/BTC:$RATIO $line" || exit 1 - - #RED='\033[0:31m' - echo -e "${RED}BTC:$BTC ETH:$ETH ETH/BTC:$RATIO $line" || exit 1 + echo -e "$NORD | ${RED}BTC:$BTC ETH:$ETH ETH/BTC:$RATIO | $line" || exit 1 done