From 268b67a6f0ecd613f9300a5e38359f0ff4956d14 Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Thu, 4 Oct 2012 13:39:35 -0500 Subject: [PATCH] * usr/lib/byobu/memory: LP: #1059307 - drop fo_cached calculation, which was not actually used - change foreground color of free memory percentage to yellow, if its over 90% used - use a better variable name for memory usage --- debian/changelog | 5 +++++ usr/lib/byobu/memory | 11 ++++++++--- usr/share/man/man1/byobu.1 | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index 2a442385..3c13f3e8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,11 @@ byobu (5.22) unreleased; urgency=low - clean up obsolete config file * usr/share/byobu/keybindings/f-keys.screen: - create a new shell when splitting a window in byobu-screen + * usr/lib/byobu/memory: LP: #1059307 + - drop fo_cached calculation, which was not actually used + - change foreground color of free memory percentage to yellow, + if its over 90% used + - use a better variable name for memory usage [ Jake Biesinger and Dustin Kirkland ] * usr/share/byobu/keybindings/common, usr/share/byobu/keybindings/f- diff --git a/usr/lib/byobu/memory b/usr/lib/byobu/memory index 07195b53..79c779d6 100755 --- a/usr/lib/byobu/memory +++ b/usr/lib/byobu/memory @@ -39,9 +39,8 @@ __memory() { buffers_plus_cached=$(($buffers+$cached)) # "free output" buffers and cache (output from 'free') fo_buffers=$(($kb_main_used - $buffers_plus_cached)) - fo_cached=$(($kb_main_free + $buffers_plus_cached)) fpdiv $((100*${fo_buffers})) "${total}" 0; - f=${_RET} + usage=${_RET} if [ $total -ge 1048576 ]; then fpdiv "$total" 1048567 1 total=${_RET} @@ -53,8 +52,14 @@ __memory() { else unit="$ICON_KB" fi + if [ $usage -gt 90 ]; then + # Change foreground to yellow, if usage over 90% + fg="Y" + else + fg="W" + fi [ -n "$total" ] || return - color b g W; printf "%s" "$total"; color -; color g W; printf "%s" "$unit"; color -; color b g W; printf "%s" "$f"; color -; color g W; printf "%s" "$PCT"; color -- + color b g W; printf "%s" "$total"; color -; color g W; printf "%s" "$unit"; color -; color b g "$fg"; printf "%s" "$usage"; color -; color g "$fg"; printf "%s" "$PCT"; color -- } # vi: syntax=sh ts=4 noexpandtab diff --git a/usr/share/man/man1/byobu.1 b/usr/share/man/man1/byobu.1 index a7fe186f..4d04d755 100644 --- a/usr/share/man/man1/byobu.1 +++ b/usr/share/man/man1/byobu.1 @@ -74,7 +74,7 @@ The background colors of the \fBbyobu\fP status lines can be adjusted by editing \fBmail\fP \- system mail for the current user; the letter '[M]' is displayed in the lower bar toward the left in black text on a grey background -\fBmemory\fP \- total memory available and used in the system; displayed in the lower bar toward the right in white text on a green background +\fBmemory\fP \- total memory available and used percentage in the system; displayed in the lower bar toward the right in white text on a green background \fBmenu\fP \- a simple indicator directing new users to use the F9 keybinding to access the byobu menu