polybar and wireguard utilities addition.

This commit is contained in:
2018-12-03 15:22:40 -02:00
parent 6224ae8e3e
commit 415a369096
3 changed files with 48 additions and 3 deletions

16
polybar/wg.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/sh
#printf "wg:" && (pgrep -a $(sudo wg)$ | head -n 1 | awk '{print $NF'} | cut -d '.' -f 1 && echo down) | head -n 1
wg=$(sudo wg);
if [ -z "$wg" ]; then
echo "(down)";
exit 0;
fi
handshake=$(echo "$wg" | grep handshake | cut -d ':' -f 2 | sed 's/minutes/min/' | sed 's/seconds/sec/');
transfer=$(echo "$wg" | grep transfer | cut -d ':' -f 2 | sed 's/sent/UL/' | sed 's/received,/DL/' | sed 's/iB//g') ;
printf "wg:$transfer($handshake)";