only print traffic if traffic not 0 & var others
modified: .config/coc/extensions/db.json modified: .config/ncmpcpp/config modified: .config/qutebrowser/quickmarks modified: .local/bin/bt modified: .local/bin/statusbar/nettraf
This commit is contained in:
@ -166,7 +166,17 @@ case $choice in
|
||||
touch "$PAIRLIST"
|
||||
fi
|
||||
fi;;
|
||||
"trust") choice=$( echo "$paired_devices" | dmenu -l 10 -i -p 'remove which paired device?')
|
||||
|
||||
"trust")
|
||||
#search through all devices which are connected and only list those as options
|
||||
# shellcheck disable=SC1091
|
||||
untrusted_devices="$( awk '{print "bluetoothctl info "$2}' "$PAIRLIST" | . /dev/stdin | grep -E '(Alias:|Trusted:)' | sed -e 'N;s/\n/;/;s/^.?*Alias: //' | grep "Trusted: no" | awk -F ';' '{print $1}' )"
|
||||
if [ "$( echo "$untrusted_devices" | wc -l )" -gt 0 ]
|
||||
then
|
||||
choice=$( echo "$untrusted_devices" | dmenu -l 10 -i -p 'remove which paired device?')
|
||||
else
|
||||
notify-send "Bluetooth" "No paired devices that are not trusted"
|
||||
fi
|
||||
if [ -n "$choice" ]; then
|
||||
dev_no=$( echo "$paired_devices" | nl | grep -P "[0-9]+\t$choice$" | awk '{print $1}')
|
||||
dev_id=$( echo "$bt_IDS" | nl | grep -P "^.*$dev_no\t" | awk '{print $2}' )
|
||||
@ -196,7 +206,6 @@ case $choice in
|
||||
echo "$choice" >> "$BLACKLIST"
|
||||
fi;;
|
||||
*)
|
||||
echo "$choice"
|
||||
dev_no=$( echo "$paired_devices" | nl | grep -P "[0-9]+\t$choice$" | awk '{print $1}')
|
||||
[ "$dev_no" != "" ] && dev_id=$( echo "$bt_IDS" | nl | grep -P "^.*$dev_no\t" | awk '{print $2}')
|
||||
if [ -n "$dev_id" ]; then
|
||||
|
@ -30,5 +30,9 @@ timedifference=$(( "$(date +'%s')" - "$previoustime" ))
|
||||
rx_avg=$(( "$rx" / "$timedifference" ))
|
||||
tx_avg=$(( "$tx" / "$timedifference" ))
|
||||
|
||||
printf "⬇%4sB/s|⬆%4sB/s\\n" $(numfmt --to=iec $rx_avg) $(numfmt --to=iec $tx_avg)
|
||||
#only print if any traffic at all
|
||||
if [ "$rx_avg" -gt 0 ] || [ "$tx_avg" -gt 0 ]
|
||||
then
|
||||
printf "⬇%4sB/s|⬆%4sB/s\\n" $(numfmt --to=iec $rx_avg) $(numfmt --to=iec $tx_avg)
|
||||
fi
|
||||
date +'%s' > $lasttime
|
||||
|
Reference in New Issue
Block a user