From 22e718f01e825c10e7da8af5119a4730c678844f Mon Sep 17 00:00:00 2001 From: Alexander Bocken Date: Tue, 7 Jul 2020 11:00:48 +0200 Subject: [PATCH] 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 --- .config/coc/extensions/db.json | 2 +- .config/ncmpcpp/config | 2 +- .config/qutebrowser/quickmarks | 1 + .local/bin/bt | 13 +++++++++++-- .local/bin/statusbar/nettraf | 6 +++++- 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/.config/coc/extensions/db.json b/.config/coc/extensions/db.json index 7f6f86c..53dcd77 100644 --- a/.config/coc/extensions/db.json +++ b/.config/coc/extensions/db.json @@ -1,3 +1,3 @@ { - "lastUpdate": 1594016620119 + "lastUpdate": 1594097478969 } \ No newline at end of file diff --git a/.config/ncmpcpp/config b/.config/ncmpcpp/config index 6874c14..e1c5f97 100644 --- a/.config/ncmpcpp/config +++ b/.config/ncmpcpp/config @@ -30,7 +30,7 @@ lyrics_directory = ~/.config/lyrics # ## Needed for tag editor and file operations to work. ## -mpd_music_dir = "~/msc" +mpd_music_dir = "~/drv/Music" # #mpd_crossfade_time = 5 # diff --git a/.config/qutebrowser/quickmarks b/.config/qutebrowser/quickmarks index 776cdef..89fa730 100644 --- a/.config/qutebrowser/quickmarks +++ b/.config/qutebrowser/quickmarks @@ -4,3 +4,4 @@ moo https://moodle-app2.let.ethz.ch/ riot https://riot.im/app/#/room/!TVGuLdRkkENrCZonlF:matrix.org fit https://boards.4channel.org/fit/ wsg https://boards.4channel.org/wsg/ +mad https://www.cse-lab.ethz.ch/teaching/mad_fs20/ diff --git a/.local/bin/bt b/.local/bin/bt index d531bed..6b90de7 100755 --- a/.local/bin/bt +++ b/.local/bin/bt @@ -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 diff --git a/.local/bin/statusbar/nettraf b/.local/bin/statusbar/nettraf index ef0e78c..e951bdb 100755 --- a/.local/bin/statusbar/nettraf +++ b/.local/bin/statusbar/nettraf @@ -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