Various changes
modified: .config/aliasrc modified: .config/coc/history.json modified: .config/gtk-2.0/gtkfilechooser.ini modified: .config/nvim/init.vim modified: .config/qutebrowser/autoconfig.yml modified: .config/qutebrowser/bookmarks/urls modified: .config/qutebrowser/qsettings/QtProject.conf modified: .config/qutebrowser/quickmarks modified: .config/xprofile modified: .config/zsh/.zshrc modified: .local/bin/bt modified: .local/bin/statusbar/getpomminutes modified: .local/bin/statusbar/getpomminutesft modified: .local/bin/statusbar/nettraf
This commit is contained in:
@ -3,4 +3,5 @@ day=$(date '+%Y%b%d')
|
||||
logged=$(grep -v Break ~/eth/pomodoros | grep $(date '+%Y%b%d') | grep -Eo "\(.*\)" | paste -sd+ | bc)
|
||||
temp=$(cat /tmp/pomptemptimes 2>/dev/null)
|
||||
min=$([ "$logged" != "" ] && ([ "$temp" != "" ] && echo "$logged + $temp" | bc || echo $logged ) || ([ "$temp" != "" ] && echo $temp))
|
||||
[ -n "$min" ] && echo '🍅'$min
|
||||
[ -n "$min" ] && printf '🍅%s' "$min"
|
||||
printf '\n'
|
||||
|
@ -3,4 +3,5 @@ day=$(date '+%Y%b%d')
|
||||
logged=$(grep -v Break ~/bks/pomodoros_freetime | grep $(date '+%Y%b%d') | grep -Eo "\(.*\)" | paste -sd+ | bc)
|
||||
temp=$(cat /tmp/pomptemptimesft 2>/dev/null)
|
||||
min=$([ "$logged" != "" ] && ([ "$temp" != "" ] && echo "$logged + $temp" | bc || echo $logged ) || ([ "$temp" != "" ] && echo $temp))
|
||||
[ -n "$min" ] && echo '📚'$min
|
||||
[ -n "$min" ] && printf '📚%s'"$min"
|
||||
printf '\n'
|
||||
|
@ -4,11 +4,7 @@
|
||||
# transmitted (TX) since the previous time this script ran. So if run every
|
||||
# second, gives network traffic per second.
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
3) notify-send "🌐 Network traffic module" "🔻: Traffic received
|
||||
🔺: Traffic transmitted" ;;
|
||||
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
||||
esac
|
||||
lasttime=${XDG_CACHE_HOME:-$HOME/.cache}/nettraf_time
|
||||
|
||||
update() {
|
||||
sum=0
|
||||
@ -22,24 +18,18 @@ update() {
|
||||
printf %d\\n $(( sum - old ))
|
||||
}
|
||||
|
||||
lasttime=${XDG_CACHE_HOME:-$HOME/.cache}/nettraf_time
|
||||
[ -f "$lasttime" ] && read -r previoustime < "$lasttime" || previoustime=0
|
||||
rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes)
|
||||
tx=$(update /sys/class/net/[ew]*/statistics/tx_bytes)
|
||||
timedifference=$(( "$(date +'%s')" - "$previoustime" ))
|
||||
if [ -n "$timedifference" ]; then
|
||||
|
||||
if [ "$timedifference" -gt 0 ]; then
|
||||
rx_avg=$(( "$rx" / "$timedifference" ))
|
||||
tx_avg=$(( "$tx" / "$timedifference" ))
|
||||
else
|
||||
rx_avg=rx_bytes
|
||||
tx_avg=tx_bytes
|
||||
rx_avg=$rx
|
||||
tx_avg=$tx
|
||||
fi
|
||||
|
||||
|
||||
#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) | sed 's/ //g'
|
||||
printf "⬇%sB/s ⬆%sB/s\\n" $(numfmt --to=iec $rx_avg) $(numfmt --to=iec $tx_avg)
|
||||
fi
|
||||
date +'%s' > $lasttime
|
||||
printf '⬇%s ⬆%s\n' $(numfmt --to=iec $rx_avg) $(numfmt --to=iec $tx_avg)
|
||||
date +'%s' > "$lasttime"
|
||||
|
Reference in New Issue
Block a user