X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;f=bin%2Fkhatus_show;h=4e90c48c14d998942d6421043b12249b5604d201;hb=0ca0fd63a00c21f3f127054401bb27f729d89abc;hp=ae9bf0ff2945ef28bf9c25ae062b1dd85307c454;hpb=f32c814ff7d5de33d091209e4ae40435c42b45bd;p=khatus.git diff --git a/bin/khatus_show b/bin/khatus_show index ae9bf0f..4e90c48 100755 --- a/bin/khatus_show +++ b/bin/khatus_show @@ -44,19 +44,27 @@ disk=$( function round(n) {return int(n + 0.5)} $1 == "/dev/mapper/kubuntu--vg-root" { - curr = $5; - sub("%$", "", curr); - prev_file = "/home/siraaj/var/run/status/disk_space_used_percentage"; - getline prev < prev_file; - print curr > prev_file; - if (curr > prev) { + curr_blocks = $3; + curr_perc = $5; sub("%$", "", curr_perc); + prev_file_prefix = "/home/siraaj/var/run/status/disk_space_used"; + + prev_perc_file = prev_file_prefix "_percentage"; + prev_blocks_file = prev_file_prefix "_blocks"; + + getline prev_blocks < prev_blocks_file; + getline prev_perc < prev_perc_file; + + print curr_blocks > prev_blocks_file; + print curr_perc > prev_perc_file; + if (curr_perc > prev_perc) { direction = ">"; - } else if (curr < prev) { + } else if (curr_perc < prev_perc) { direction = "<"; } else { direction = "="; } - printf("%s%d%%", direction, curr); + diff_blocks = curr_blocks - prev_blocks; + printf("%s[%d%% %d]", direction, curr_perc, diff_blocks); }') io_net=$( @@ -253,7 +261,7 @@ else rm -f "$STATUS_FILE__ENERGY_NOTIFIED_BELLOW_HALF" fi -weather="$(cat ~/var/run/metar-KJFK-decoded-temp-fahrenheit)°F" +weather=$(awk 'NR == 1 {printf("%d°F", $1)}' ~/var/run/metar-KJFK-decoded-temp-fahrenheit) signal_last_msg_age=$( ls -lt --time-style=+%s $HOME/var/lib/signal/latest_message.json \