From 5d90d8cba1da6591a63aae87108e9251fad00903 Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Thu, 22 Jan 2009 00:08:38 -0500 Subject: [PATCH] add memory usage information --- bin/mem-available | 4 ++-- bin/mem-used | 4 ++++ debian/changelog | 6 ++++-- debian/install | 1 + profiles/common | 3 ++- profiles/ubuntu | 2 +- 6 files changed, 14 insertions(+), 6 deletions(-) create mode 100755 bin/mem-used diff --git a/bin/mem-available b/bin/mem-available index 0cd008c5..ef19c12c 100755 --- a/bin/mem-available +++ b/bin/mem-available @@ -1,11 +1,11 @@ #!/bin/sh -e -mem=`grep -m 1 "^MemTotal:" /proc/meminfo | sed 's/ kB$//' | sed 's/^.* //'` +mem=`free | grep -m 1 "^Mem:" | awk '{print $2}'` if [ $mem -gt 1000000 -a -x /usr/bin/bc ]; then mem=$(echo "scale=1; $mem/1000000" | bc) echo "$mem""GB" elif [ $mem -gt 1000 -a -x /usr/bin/bc ]; then - mem=$(echo "scale=1; $mem/1000" | bc) + mem=$(echo "scale=0; $mem/1000" | bc) echo "$mem""MB" else echo "$mem""KB" diff --git a/bin/mem-used b/bin/mem-used new file mode 100755 index 00000000..202da925 --- /dev/null +++ b/bin/mem-used @@ -0,0 +1,4 @@ +#!/bin/sh -e + +mem=`free | grep -m 1 "^Mem:" | awk '{printf "%.0f", 100 * $3 / $2}'` +echo $mem"%" diff --git a/debian/changelog b/debian/changelog index d57af090..7b280762 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,10 @@ screen-profiles (1.13) UNRELEASED; urgency=low - * + * bin/updates-available: fix bug when no updates are available + * bin/mem-used, profiles/common, profiles/ubuntu: add memory usage + information - -- Dustin Kirkland Wed, 21 Jan 2009 01:42:57 -0600 + -- Dustin Kirkland Thu, 22 Jan 2009 00:08:15 -0500 screen-profiles (1.12-0ubuntu1) jaunty; urgency=low diff --git a/debian/install b/debian/install index 58ef63eb..8481c5b4 100644 --- a/debian/install +++ b/debian/install @@ -2,6 +2,7 @@ bin/cpu-count usr/share/screen-profiles/bin bin/cpu-freq usr/share/screen-profiles/bin bin/load-average usr/share/screen-profiles/bin bin/mem-available usr/share/screen-profiles/bin +bin/mem-used usr/share/screen-profiles/bin bin/reboot-required usr/share/screen-profiles/bin bin/release usr/share/screen-profiles/bin bin/updates-available usr/share/screen-profiles/bin diff --git a/profiles/common b/profiles/common index 2db326e4..7fb825df 100644 --- a/profiles/common +++ b/profiles/common @@ -31,11 +31,12 @@ msgwait 1 # Define status commands backtick 100 3600 3600 /usr/share/screen-profiles/bin/release backtick 101 60 60 /usr/share/screen-profiles/bin/updates-available -backtick 102 10 10 /usr/share/screen-profiles/bin/reboot-required +backtick 102 5 5 /usr/share/screen-profiles/bin/reboot-required backtick 103 5 5 /usr/share/screen-profiles/bin/cpu-freq backtick 104 3600 3600 /usr/share/screen-profiles/bin/cpu-count backtick 105 3600 3600 /usr/share/screen-profiles/bin/mem-available backtick 106 5 5 /usr/share/screen-profiles/bin/load-average +backtick 107 10 10 /usr/share/screen-profiles/bin/mem-used hardstatus alwayslastline diff --git a/profiles/ubuntu b/profiles/ubuntu index 3c90d2d2..a6595364 100644 --- a/profiles/ubuntu +++ b/profiles/ubuntu @@ -21,7 +21,7 @@ source /usr/share/screen-profiles/profiles/common -hardstatus string '%{+b Wr}\%{= Wy}o%{=b WY}/%{=b Wk} %100` %{= Wk} %= %{=b bW}%102`%{= Wk} %{=b rW}%101`%{= Wk} %{= Yk}%106`%{= Wk} %{= Wk}%104`%{=b cW}%103`%{= Wk} %{=b gW}%105`%{= Wk} %Y-%m-%d %0c:%s' +hardstatus string '%{+b Wr}\%{= Wy}o%{=b WY}/%{=b Wk} %100` %{= Wk} %= %{=b bW}%102`%{= Wk} %{=b rW}%101`%{= Wk} %{= Yk}%106`%{= Wk} %{= Wk}%104`%{=b cW}%103`%{= Wk} %{=b gW}%107`/%105`%{= Wk} %Y-%m-%d %0c:%s' # NOTE: There is an arbitrary limit of being able to change colors 16 times # in this 'hardstatus string'.