polybar and wireguard utilities addition.
This commit is contained in:
16
polybar/wg.sh
Executable file
16
polybar/wg.sh
Executable 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)";
|
||||
Reference in New Issue
Block a user