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:
Alexander Bocken 2020-07-07 11:00:48 +02:00
parent c8c0d8c2b0
commit 22e718f01e
5 changed files with 19 additions and 5 deletions

View File

@ -1,3 +1,3 @@
{ {
"lastUpdate": 1594016620119 "lastUpdate": 1594097478969
} }

View File

@ -30,7 +30,7 @@ lyrics_directory = ~/.config/lyrics
# #
## Needed for tag editor and file operations to work. ## Needed for tag editor and file operations to work.
## ##
mpd_music_dir = "~/msc" mpd_music_dir = "~/drv/Music"
# #
#mpd_crossfade_time = 5 #mpd_crossfade_time = 5
# #

View File

@ -4,3 +4,4 @@ moo https://moodle-app2.let.ethz.ch/
riot https://riot.im/app/#/room/!TVGuLdRkkENrCZonlF:matrix.org riot https://riot.im/app/#/room/!TVGuLdRkkENrCZonlF:matrix.org
fit https://boards.4channel.org/fit/ fit https://boards.4channel.org/fit/
wsg https://boards.4channel.org/wsg/ wsg https://boards.4channel.org/wsg/
mad https://www.cse-lab.ethz.ch/teaching/mad_fs20/

View File

@ -166,7 +166,17 @@ case $choice in
touch "$PAIRLIST" touch "$PAIRLIST"
fi fi
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 if [ -n "$choice" ]; then
dev_no=$( echo "$paired_devices" | nl | grep -P "[0-9]+\t$choice$" | awk '{print $1}') 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}' ) dev_id=$( echo "$bt_IDS" | nl | grep -P "^.*$dev_no\t" | awk '{print $2}' )
@ -196,7 +206,6 @@ case $choice in
echo "$choice" >> "$BLACKLIST" echo "$choice" >> "$BLACKLIST"
fi;; fi;;
*) *)
echo "$choice"
dev_no=$( echo "$paired_devices" | nl | grep -P "[0-9]+\t$choice$" | awk '{print $1}') 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}') [ "$dev_no" != "" ] && dev_id=$( echo "$bt_IDS" | nl | grep -P "^.*$dev_no\t" | awk '{print $2}')
if [ -n "$dev_id" ]; then if [ -n "$dev_id" ]; then

View File

@ -30,5 +30,9 @@ timedifference=$(( "$(date +'%s')" - "$previoustime" ))
rx_avg=$(( "$rx" / "$timedifference" )) rx_avg=$(( "$rx" / "$timedifference" ))
tx_avg=$(( "$tx" / "$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 date +'%s' > $lasttime