1
0
Fork 0
dotfiles/dot_config/polybar/scripts/executable_polybar_net_speed.sh
Florian RICHER fd95dd8b8f Update dot_config/polybar/scripts/executable_polybar_bluetooth_speaker.sh
Update dot_config/polybar/scripts/executable_polybar_custom_time.sh
Update dot_config/polybar/scripts/executable_polybar_dunst_indicator.sh
Update dot_config/polybar/scripts/executable_polybar_healthbar.sh
Update dot_config/polybar/scripts/executable_polybar_net_indicator.sh
Update dot_config/polybar/scripts/executable_polybar_net_speed.sh
Update dot_config/polybar/scripts/executable_polybar_redshift_indicator.sh
Update dot_config/polybar/scripts/executable_polybar_wifibar.sh
2022-05-07 00:08:56 +02:00

17 lines
738 B
Bash

#!/bin/bash
#
# Custom network download/upload speed indicator for polybar.
#
# Author: machaerus
# https://gitlab.com/machaerus
source ~/.config/polybar/scripts/colors.sh
net_speed() {
UP_NETSPEED=$(awk '{if(l1){printf "%6.1f", ($10-l2)/1024} else{l1=$2; l2=$10;}}' <(grep wlan0 /proc/net/dev) <(sleep 1; grep wlan0 /proc/net/dev))
DOWN_NETSPEED=$(awk '{if(l1){printf "%6.1f", ($2-l1)/1024} else{l1=$2; l2=$10;}}' <(grep wlan0 /proc/net/dev) <(sleep 1; grep wlan0 /proc/net/dev))
# echo "$dark0_soft [ $faded_aqua $UP_NETSPEED KB/s$RESET $faded_green↓ $DOWN_NETSPEED KB/s$RESET $dark0_soft]"
echo "$dark0_soft $faded_aqua$UP_NETSPEED KB/s$RESET $faded_green$DOWN_NETSPEED KB/s$RESET $dark0_soft"
}
# net_speed