1
0
mirror of https://github.com/dcarrillo/dotfiles.git synced 2024-12-22 18:38:00 +00:00

[polybar] Fix network_usage when a VPN is enabled

This commit is contained in:
Daniel Carrillo 2021-06-15 09:13:46 +02:00
parent 1078c005b0
commit 3c634f4870
Signed by: dcarrillo
GPG Key ID: E4CD5C09DAED6E16

View File

@ -31,6 +31,10 @@ while true; do
now=$(date +%s) now=$(date +%s)
counter_age=$(stat --format %Z $COUNTER_FILE 2>/dev/null) counter_age=$(stat --format %Z $COUNTER_FILE 2>/dev/null)
if [ "$default_device" = "link" ]; then
default_device=$(ip route list | grep -Fm 1 default | cut -d " " -f 3)
fi
if [ -f $COUNTER_FILE ] && [ $((now-counter_age)) -lt $((REFRESH+1)) ]; then if [ -f $COUNTER_FILE ] && [ $((now-counter_age)) -lt $((REFRESH+1)) ]; then
last_value_in=$(cut -f 1 -d " " $COUNTER_FILE) last_value_in=$(cut -f 1 -d " " $COUNTER_FILE)
last_value_out=$(cut -f 2 -d " " $COUNTER_FILE) last_value_out=$(cut -f 2 -d " " $COUNTER_FILE)