From 7899b1f5a9c73e2f9f17df3c4eb28dd912522f37 Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Fri, 3 Apr 2009 12:27:46 -0500 Subject: [PATCH] bin/processes: displace a count of the running processes -Dustin Kirkland Fri, 03 Apr 2009 12:23:14 -0500 --- bin/ec2-cost | 2 +- bin/processes | 24 ++++++++++++++++++++++++ bin/uptime | 10 ++++++---- bin/users | 2 +- debian/changelog | 3 ++- po/es.po | 36 ++++++++++++++++++------------------ po/fr.po | 36 ++++++++++++++++++------------------ po/screen-profiles.pot | 36 ++++++++++++++++++------------------ profiles/common | 3 ++- profiles/profile.skel | 2 +- screen-profiles | 1 + 11 files changed, 92 insertions(+), 63 deletions(-) create mode 100755 bin/processes diff --git a/bin/ec2-cost b/bin/ec2-cost index 186aa100..bd02a4d1 100755 --- a/bin/ec2-cost +++ b/bin/ec2-cost @@ -95,4 +95,4 @@ if [ "$DETAIL" = "1" ]; then exit 0 fi -printf "\005{= Wg}%s\005{-} " $total_cost +printf "\005{= wg}%s\005{-} " $total_cost diff --git a/bin/processes b/bin/processes new file mode 100755 index 00000000..f5396f2c --- /dev/null +++ b/bin/processes @@ -0,0 +1,24 @@ +#!/bin/sh -e +# +# processes - report number of running processes +# Copyright (C) 2008 Canonical Ltd. +# +# Authors: Dustin Kirkland +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, version 3 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Default is "off" +p="processes" +grep -qs "^$p=1$" "$HOME/.screen-profiles/status" || exit 0 + +printf "\005{=b }%s&\005{-} " $(ps -e | wc -l) diff --git a/bin/uptime b/bin/uptime index b0bf4b79..3e625b23 100755 --- a/bin/uptime +++ b/bin/uptime @@ -25,12 +25,14 @@ p="uptime" grep -qs "^$p=1$" "$HOME/.screen-profiles/status" || exit 0 u=$(sed "s/\..*$//" /proc/uptime) +printf "\005{=b }" if [ "$u" -gt 86400 ]; then - printf "%dd " `echo "$u" | awk '{printf "%.0f", $1 / 86400 }'` + printf "%dd" `echo "$u" | awk '{printf "%.0f", $1 / 86400 }'` elif [ "$u" -gt 3600 ]; then - printf "%dh " `echo "$u" | awk '{printf "%.0f", $1 / 3600 }'` + printf "%dh" `echo "$u" | awk '{printf "%.0f", $1 / 3600 }'` elif [ "$u" -gt 60 ]; then - printf "%dm " `echo "$u" | awk '{printf "%.0f", $1 / 60 }'` + printf "%dm" `echo "$u" | awk '{printf "%.0f", $1 / 60 }'` else - printf "%ds " "$u" + printf "%ds" "$u" fi +printf "\005{-} " diff --git a/bin/users b/bin/users index 233bd5fe..61c7f871 100755 --- a/bin/users +++ b/bin/users @@ -24,4 +24,4 @@ p="users" grep -qs "^$p=1$" "$HOME/.screen-profiles/status" || exit 0 -printf "#%d " `who | wc -l` +printf "\005{=b }%d#\005{-} " `who | wc -l` diff --git a/debian/changelog b/debian/changelog index 95b40b3a..78c28b89 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,7 @@ screen-profiles (1.43) unreleased; urgency=low [ Dustin Kirkland ] * bin/logo: allow users to define their own logo + * bin/processes: displace a count of the running processes * bin/*, profiles/profile.skel: make all status scripts handle their own colors and trailing whitespace; this should help alleviate the 16-color-change limitation on un-patched screens; it also simplifies @@ -12,7 +13,7 @@ screen-profiles (1.43) unreleased; urgency=low added new status items for battery state, number of users, and system uptime - -- Dustin Kirkland Fri, 03 Apr 2009 12:06:45 -0500 + -- Dustin Kirkland Fri, 03 Apr 2009 12:23:14 -0500 screen-profiles (1.42-0ubuntu1) jaunty; urgency=low diff --git a/po/es.po b/po/es.po index 45261b97..9ab97eaf 100644 --- a/po/es.po +++ b/po/es.po @@ -3,13 +3,13 @@ # This file is distributed under the same license as the GNU Screen Profiles package. # Nicolas Valcarcel , 2008. # -#: screen-profiles:300 +#: screen-profiles:301 #, fuzzy msgid "" msgstr "" "Project-Id-Version: 1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-04-03 12:03-0500\n" +"POT-Creation-Date: 2009-04-03 12:25-0500\n" "PO-Revision-Date: 2008-12-22 01:01-0500\n" "Last-Translator: Nicolas Valcarcel \n" "Language-Team: LANGUAGE \n" @@ -57,7 +57,7 @@ msgstr "" msgid "Exit" msgstr "" -#: screen-profiles:87 screen-profiles:466 +#: screen-profiles:87 screen-profiles:467 msgid " Screen Profiles Configuration Menu" msgstr "" @@ -66,14 +66,14 @@ msgid "Okay" msgstr "" #: screen-profiles:98 screen-profiles:134 screen-profiles:150 -#: screen-profiles:185 screen-profiles:307 screen-profiles:349 -#: screen-profiles:427 +#: screen-profiles:185 screen-profiles:308 screen-profiles:350 +#: screen-profiles:428 msgid "Cancel" msgstr "" #: screen-profiles:116 screen-profiles:143 screen-profiles:157 -#: screen-profiles:320 screen-profiles:374 screen-profiles:382 -#: screen-profiles:455 +#: screen-profiles:321 screen-profiles:375 screen-profiles:383 +#: screen-profiles:456 msgid "Menu" msgstr "" @@ -82,7 +82,7 @@ msgid "Screen Profiles Help" msgstr "" #: screen-profiles:134 screen-profiles:150 screen-profiles:185 -#: screen-profiles:307 screen-profiles:349 screen-profiles:427 +#: screen-profiles:308 screen-profiles:350 screen-profiles:428 msgid "Apply" msgstr "" @@ -90,8 +90,8 @@ msgstr "" msgid "Which profile would you like to use?" msgstr "" -#: screen-profiles:142 screen-profiles:156 screen-profiles:319 -#: screen-profiles:381 screen-profiles:453 +#: screen-profiles:142 screen-profiles:156 screen-profiles:320 +#: screen-profiles:382 screen-profiles:454 msgid "Message" msgstr "" @@ -119,35 +119,35 @@ msgstr "" msgid "Create new window(s):" msgstr "" -#: screen-profiles:308 +#: screen-profiles:309 msgid "Toggle status notifications:" msgstr "" -#: screen-profiles:341 +#: screen-profiles:342 msgid "Windows:" msgstr "" -#: screen-profiles:351 +#: screen-profiles:352 msgid "Select window(s) to create by default:" msgstr "" -#: screen-profiles:371 +#: screen-profiles:372 msgid "Screen will be launched automatically next time you login." msgstr "" -#: screen-profiles:379 +#: screen-profiles:380 msgid "Screen will not be used next time you login." msgstr "" -#: screen-profiles:426 +#: screen-profiles:427 msgid "Escape key: ctrl-" msgstr "" -#: screen-profiles:429 +#: screen-profiles:430 msgid "Change escape sequence:" msgstr "" -#: screen-profiles:467 +#: screen-profiles:468 msgid "/ between elements | Validates" msgstr "" diff --git a/po/fr.po b/po/fr.po index 37a9d347..c4866e13 100644 --- a/po/fr.po +++ b/po/fr.po @@ -3,13 +3,13 @@ # This file is distributed under the same license as the GNU Screen Profiles package. # Nicolas Barcet , 2008. # -#: screen-profiles:300 +#: screen-profiles:301 #, fuzzy msgid "" msgstr "" "Project-Id-Version: 1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-04-03 12:03-0500\n" +"POT-Creation-Date: 2009-04-03 12:25-0500\n" "PO-Revision-Date: 2008-12-17 23:42+0100\n" "Last-Translator: Nicolas Barcet \n" "Language-Team: LANGUAGE \n" @@ -57,7 +57,7 @@ msgstr "" msgid "Exit" msgstr "" -#: screen-profiles:87 screen-profiles:466 +#: screen-profiles:87 screen-profiles:467 msgid " Screen Profiles Configuration Menu" msgstr "" @@ -66,14 +66,14 @@ msgid "Okay" msgstr "" #: screen-profiles:98 screen-profiles:134 screen-profiles:150 -#: screen-profiles:185 screen-profiles:307 screen-profiles:349 -#: screen-profiles:427 +#: screen-profiles:185 screen-profiles:308 screen-profiles:350 +#: screen-profiles:428 msgid "Cancel" msgstr "" #: screen-profiles:116 screen-profiles:143 screen-profiles:157 -#: screen-profiles:320 screen-profiles:374 screen-profiles:382 -#: screen-profiles:455 +#: screen-profiles:321 screen-profiles:375 screen-profiles:383 +#: screen-profiles:456 msgid "Menu" msgstr "" @@ -82,7 +82,7 @@ msgid "Screen Profiles Help" msgstr "" #: screen-profiles:134 screen-profiles:150 screen-profiles:185 -#: screen-profiles:307 screen-profiles:349 screen-profiles:427 +#: screen-profiles:308 screen-profiles:350 screen-profiles:428 msgid "Apply" msgstr "" @@ -90,8 +90,8 @@ msgstr "" msgid "Which profile would you like to use?" msgstr "" -#: screen-profiles:142 screen-profiles:156 screen-profiles:319 -#: screen-profiles:381 screen-profiles:453 +#: screen-profiles:142 screen-profiles:156 screen-profiles:320 +#: screen-profiles:382 screen-profiles:454 msgid "Message" msgstr "" @@ -119,35 +119,35 @@ msgstr "" msgid "Create new window(s):" msgstr "" -#: screen-profiles:308 +#: screen-profiles:309 msgid "Toggle status notifications:" msgstr "" -#: screen-profiles:341 +#: screen-profiles:342 msgid "Windows:" msgstr "" -#: screen-profiles:351 +#: screen-profiles:352 msgid "Select window(s) to create by default:" msgstr "" -#: screen-profiles:371 +#: screen-profiles:372 msgid "Screen will be launched automatically next time you login." msgstr "" -#: screen-profiles:379 +#: screen-profiles:380 msgid "Screen will not be used next time you login." msgstr "" -#: screen-profiles:426 +#: screen-profiles:427 msgid "Escape key: ctrl-" msgstr "" -#: screen-profiles:429 +#: screen-profiles:430 msgid "Change escape sequence:" msgstr "" -#: screen-profiles:467 +#: screen-profiles:468 msgid "/ between elements | Validates" msgstr "" diff --git a/po/screen-profiles.pot b/po/screen-profiles.pot index c4854258..4ffed56c 100644 --- a/po/screen-profiles.pot +++ b/po/screen-profiles.pot @@ -3,13 +3,13 @@ # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # -#: screen-profiles:300 +#: screen-profiles:301 #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-04-03 12:03-0500\n" +"POT-Creation-Date: 2009-04-03 12:25-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -57,7 +57,7 @@ msgstr "" msgid "Exit" msgstr "" -#: screen-profiles:87 screen-profiles:466 +#: screen-profiles:87 screen-profiles:467 msgid " Screen Profiles Configuration Menu" msgstr "" @@ -66,14 +66,14 @@ msgid "Okay" msgstr "" #: screen-profiles:98 screen-profiles:134 screen-profiles:150 -#: screen-profiles:185 screen-profiles:307 screen-profiles:349 -#: screen-profiles:427 +#: screen-profiles:185 screen-profiles:308 screen-profiles:350 +#: screen-profiles:428 msgid "Cancel" msgstr "" #: screen-profiles:116 screen-profiles:143 screen-profiles:157 -#: screen-profiles:320 screen-profiles:374 screen-profiles:382 -#: screen-profiles:455 +#: screen-profiles:321 screen-profiles:375 screen-profiles:383 +#: screen-profiles:456 msgid "Menu" msgstr "" @@ -82,7 +82,7 @@ msgid "Screen Profiles Help" msgstr "" #: screen-profiles:134 screen-profiles:150 screen-profiles:185 -#: screen-profiles:307 screen-profiles:349 screen-profiles:427 +#: screen-profiles:308 screen-profiles:350 screen-profiles:428 msgid "Apply" msgstr "" @@ -90,8 +90,8 @@ msgstr "" msgid "Which profile would you like to use?" msgstr "" -#: screen-profiles:142 screen-profiles:156 screen-profiles:319 -#: screen-profiles:381 screen-profiles:453 +#: screen-profiles:142 screen-profiles:156 screen-profiles:320 +#: screen-profiles:382 screen-profiles:454 msgid "Message" msgstr "" @@ -119,34 +119,34 @@ msgstr "" msgid "Create new window(s):" msgstr "" -#: screen-profiles:308 +#: screen-profiles:309 msgid "Toggle status notifications:" msgstr "" -#: screen-profiles:341 +#: screen-profiles:342 msgid "Windows:" msgstr "" -#: screen-profiles:351 +#: screen-profiles:352 msgid "Select window(s) to create by default:" msgstr "" -#: screen-profiles:371 +#: screen-profiles:372 msgid "Screen will be launched automatically next time you login." msgstr "" -#: screen-profiles:379 +#: screen-profiles:380 msgid "Screen will not be used next time you login." msgstr "" -#: screen-profiles:426 +#: screen-profiles:427 msgid "Escape key: ctrl-" msgstr "" -#: screen-profiles:429 +#: screen-profiles:430 msgid "Change escape sequence:" msgstr "" -#: screen-profiles:467 +#: screen-profiles:468 msgid "/ between elements | Validates" msgstr "" diff --git a/profiles/common b/profiles/common index 2a1d71b7..9652aa08 100644 --- a/profiles/common +++ b/profiles/common @@ -41,8 +41,9 @@ backtick 110 86400 86400 /var/lib/screen-profiles/whoami backtick 111 86400 86400 /var/lib/screen-profiles/menu backtick 112 86400 86400 /var/lib/screen-profiles/arch backtick 113 30 30 /var/lib/screen-profiles/battery -backtick 114 2 2 /var/lib/screen-profiles/users +backtick 114 10 10 /var/lib/screen-profiles/users backtick 115 60 60 /var/lib/screen-profiles/uptime +backtick 116 2 2 /var/lib/screen-profiles/processes hardstatus alwayslastline diff --git a/profiles/profile.skel b/profiles/profile.skel index e738484b..fb1273bb 100644 --- a/profiles/profile.skel +++ b/profiles/profile.skel @@ -26,7 +26,7 @@ source /usr/share/screen-profiles/profiles/common caption always "%{kW}%?%-Lw%?%{bw}%n*%f %t%?(%u)%?%{kW}%?%+Lw%? %= %{= Wk}%110`%109`%111`" # Status string, last line -hardstatus string '%{= Wk}%99`%{= Wk} %100`%112`%= %115`%114`%108`%113`%102`%101`%106`%104`%103`%105`%107`%Y-%m-%d %0c:%s' +hardstatus string '%{= Wk}%99`%{= Wk} %100`%112`%= %115`%114`%116`%108`%113`%102`%101`%106`%104`%103`%105`%107`%Y-%m-%d %0c:%s' # NOTE: Older version of screen have an arbitrary limit of only being able # to change colors 16 times in this 'hardstatus string'. diff --git a/screen-profiles b/screen-profiles index 947b7dfd..c47a300f 100755 --- a/screen-profiles +++ b/screen-profiles @@ -257,6 +257,7 @@ def readstatus(): status["mem-available"]=1 status["mem-used"]=1 status["menu"]=1 + status["processes"]=0 status["reboot-required"]=1 status["release"]=1 status["updates-available"]=1