remove status config check for on/off from each individual script

and use the commone one in screen-profiles-status
This commit is contained in:
Dustin Kirkland 2009-04-07 07:52:17 -07:00
commit cece89bbb8
24 changed files with 59 additions and 136 deletions

View file

@ -17,8 +17,4 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Default is "off"
p="arch"
grep -qs "^$p=1$" "$HOME/.screen-profiles/status" || exit 0
printf "%s " $(uname -m)

View file

@ -19,10 +19,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Default is "off"
p="battery"
grep -qs "^$p=1$" "$HOME/.screen-profiles/status" || exit 0
search () {
local str expr
str="$1"

View file

@ -17,9 +17,5 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Default is "on"
p="cpu-count"
grep -qs "^$p=0$" "$HOME/.screen-profiles/status" && exit 0
count=`grep -c "^processor.*:" /proc/cpuinfo`
[ "$count" = "1" ] || echo $count"x"

View file

@ -17,10 +17,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Default is "on"
p="cpu-freq"
grep -qs "^$p=0$" "$HOME/.screen-profiles/status" && exit 0
mhz=`grep -m 1 "^cpu MHz" /proc/cpuinfo | awk -F"[:.]" '{print $2}'` || mhz=`grep -m 1 "^clock" /proc/cpuinfo | awk -F"[:.]" '{print $2}'`
if [ $mhz -ge 1000 ]; then

View file

@ -17,9 +17,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Default is "off"
p="hostname"
grep -qs "^$p=1$" "$HOME/.screen-profiles/status" || exit 0
at=
grep -qs "^whoami=1$" "$HOME/.screen-profiles/status" && at="@"

View file

@ -17,8 +17,4 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Default is "on"
p="load-average"
grep -qs "^$p=0$" "$HOME/.screen-profiles/status" && exit 0
printf "\005{= Yk}%s\005{-} " $(cat /proc/loadavg | cut -d " " -f -1)

View file

@ -17,10 +17,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Default is on
p="logo"
grep -qs "^$p=0$" "$HOME/.screen-profiles/status" && exit 0
if [ -r "$HOME/.screen-profiles/logo" ]; then
# Allow users to define their own logo
cat "$HOME/.screen-profiles/logo"

View file

@ -17,9 +17,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Default is on
p="mem-available"
grep -qs "^$p=0$" "$HOME/.screen-profiles/status" && exit 0
comma=
whitespace=
grep -qs "^mem-used=1$" "$HOME/.screen-profiles/status" && comma="," || whitespace=" "

View file

@ -17,8 +17,4 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Default is on
p="mem-used"
grep -qs "^$p=0$" "$HOME/.screen-profiles/status" && exit 0
free | awk '/buffers\/cache:/ {printf "\005{=b gW}%.0f\005{-}\005{= gW}%%\005{-} ", 100*$3/($3 + $4)}'

View file

@ -17,8 +17,4 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Default is "on"
p="menu"
grep -qs "^$p=0$" "$HOME/.screen-profiles/status" && exit 0
printf " \005{= kw}%s" `gettext "Menu:<F9>"`

View file

@ -17,11 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Default is "off"
p="network-down"
grep -qs "^$p=1$" "$HOME/.screen-profiles/status" || exit 0
cache="$HOME/.screen-profiles/$p"
cache="$HOME/.screen-profiles/network-down"
interface=`route -n | tail -n 1 | sed "s/^.* //"`
unit="kB/s"

View file

@ -17,11 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Default is "off"
p="network-up"
grep -qs "^$p=1$" "$HOME/.screen-profiles/status" || exit 0
cache="$HOME/.screen-profiles/$p"
cache="$HOME/.screen-profiles/network-up"
interface=`route -n | tail -n 1 | sed "s/^.* //"`
unit="kB/s"

View file

@ -17,8 +17,4 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Default is "off"
p="processes"
grep -qs "^$p=1$" "$HOME/.screen-profiles/status" || exit 0
printf "\005{=b yk}%s\005{-}\005{= yk}&\005{-} " $(ps -e | wc -l)

View file

@ -17,8 +17,4 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Default is on
p="reboot-required"
grep -qs "^$p=0$" "$HOME/.screen-profiles/status" && exit 0
[ -e /var/run/reboot-required ] && printf "\005{=b bW}(@)\005{-} "

View file

@ -17,10 +17,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Default is on
p="release"
grep -qs "^$p=0$" "$HOME/.screen-profiles/status" && exit 0
if which lsb_release >/dev/null; then
# If lsb_release is available, use it
if lsb_release -s -d | grep -qs "^Ubuntu .*\..*\..*$"; then

View file

@ -17,10 +17,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Default is on
p="updates-available"
grep -qs "^$p=0$" "$HOME/.screen-profiles/status" && exit 0
# expire the cache in X seconds; 1 hour by default
EXPIRATION=3600

View file

@ -20,10 +20,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Default is "off"
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

View file

@ -20,8 +20,4 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Default is "off"
p="users"
grep -qs "^$p=1$" "$HOME/.screen-profiles/status" || exit 0
printf "\005{= r}%d#\005{-} " `who | wc -l`

View file

@ -17,8 +17,4 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Default is "off"
p="whoami"
grep -qs "^$p=1$" "$HOME/.screen-profiles/status" || exit 0
printf "\005{= }%s\005{-}" $(whoami)

View file

@ -17,10 +17,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Default is "off"
p="wifi-quality"
grep -qs "^$p=1$" "$HOME/.screen-profiles/status" || exit 0
interface=`route -n | tail -n 1 | sed "s/^.* //"`
bitrate=`iwconfig "$interface" 2>/dev/null | grep "Bit Rate=" | sed "s/^.*Bit Rate=//" | sed "s/ .*$//g"`
[ -z "$bitrate" ] && bitrate="0"

View file

@ -3,13 +3,13 @@
# This file is distributed under the same license as the GNU Screen Profiles package.
# Nicolas Valcarcel <nvalcarcel@ubuntu.com>, 2008.
#
#: screen-profiles:303
#: screen-profiles:304
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: 1.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-04-06 13:50-0700\n"
"POT-Creation-Date: 2009-04-07 07:50-0700\n"
"PO-Revision-Date: 2008-12-22 01:01-0500\n"
"Last-Translator: Nicolas Valcarcel <nvalcarcel@ubuntu.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -57,7 +57,7 @@ msgstr ""
msgid "Exit"
msgstr ""
#: screen-profiles:87 screen-profiles:469
#: screen-profiles:87 screen-profiles:470
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:310 screen-profiles:352
#: screen-profiles:430
#: screen-profiles:185 screen-profiles:311 screen-profiles:353
#: screen-profiles:431
msgid "Cancel"
msgstr ""
#: screen-profiles:116 screen-profiles:143 screen-profiles:157
#: screen-profiles:323 screen-profiles:377 screen-profiles:385
#: screen-profiles:458
#: screen-profiles:324 screen-profiles:378 screen-profiles:386
#: screen-profiles:459
msgid "Menu"
msgstr ""
@ -82,7 +82,7 @@ msgid "Screen Profiles Help"
msgstr ""
#: screen-profiles:134 screen-profiles:150 screen-profiles:185
#: screen-profiles:310 screen-profiles:352 screen-profiles:430
#: screen-profiles:311 screen-profiles:353 screen-profiles:431
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:322
#: screen-profiles:384 screen-profiles:456
#: screen-profiles:142 screen-profiles:156 screen-profiles:323
#: screen-profiles:385 screen-profiles:457
msgid "Message"
msgstr ""
@ -119,35 +119,35 @@ msgstr ""
msgid "Create new window(s):"
msgstr ""
#: screen-profiles:311
#: screen-profiles:312
msgid "Toggle status notifications:"
msgstr ""
#: screen-profiles:344
#: screen-profiles:345
msgid "Windows:"
msgstr ""
#: screen-profiles:354
#: screen-profiles:355
msgid "Select window(s) to create by default:"
msgstr ""
#: screen-profiles:374
#: screen-profiles:375
msgid "Screen will be launched automatically next time you login."
msgstr ""
#: screen-profiles:382
#: screen-profiles:383
msgid "Screen will not be used next time you login."
msgstr ""
#: screen-profiles:429
#: screen-profiles:430
msgid "Escape key: ctrl-"
msgstr ""
#: screen-profiles:432
#: screen-profiles:433
msgid "Change escape sequence:"
msgstr ""
#: screen-profiles:470
#: screen-profiles:471
msgid "<Tab>/<Alt-Tab> between elements | <Return> Validates"
msgstr ""

View file

@ -3,13 +3,13 @@
# This file is distributed under the same license as the GNU Screen Profiles package.
# Nicolas Barcet <nicolas.barcet@ubuntu.com>, 2008.
#
#: screen-profiles:303
#: screen-profiles:304
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: 1.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-04-06 13:50-0700\n"
"POT-Creation-Date: 2009-04-07 07:50-0700\n"
"PO-Revision-Date: 2008-12-17 23:42+0100\n"
"Last-Translator: Nicolas Barcet <nicolas.barcet@ubuntu.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -57,7 +57,7 @@ msgstr ""
msgid "Exit"
msgstr ""
#: screen-profiles:87 screen-profiles:469
#: screen-profiles:87 screen-profiles:470
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:310 screen-profiles:352
#: screen-profiles:430
#: screen-profiles:185 screen-profiles:311 screen-profiles:353
#: screen-profiles:431
msgid "Cancel"
msgstr ""
#: screen-profiles:116 screen-profiles:143 screen-profiles:157
#: screen-profiles:323 screen-profiles:377 screen-profiles:385
#: screen-profiles:458
#: screen-profiles:324 screen-profiles:378 screen-profiles:386
#: screen-profiles:459
msgid "Menu"
msgstr ""
@ -82,7 +82,7 @@ msgid "Screen Profiles Help"
msgstr ""
#: screen-profiles:134 screen-profiles:150 screen-profiles:185
#: screen-profiles:310 screen-profiles:352 screen-profiles:430
#: screen-profiles:311 screen-profiles:353 screen-profiles:431
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:322
#: screen-profiles:384 screen-profiles:456
#: screen-profiles:142 screen-profiles:156 screen-profiles:323
#: screen-profiles:385 screen-profiles:457
msgid "Message"
msgstr ""
@ -119,35 +119,35 @@ msgstr ""
msgid "Create new window(s):"
msgstr ""
#: screen-profiles:311
#: screen-profiles:312
msgid "Toggle status notifications:"
msgstr ""
#: screen-profiles:344
#: screen-profiles:345
msgid "Windows:"
msgstr ""
#: screen-profiles:354
#: screen-profiles:355
msgid "Select window(s) to create by default:"
msgstr ""
#: screen-profiles:374
#: screen-profiles:375
msgid "Screen will be launched automatically next time you login."
msgstr ""
#: screen-profiles:382
#: screen-profiles:383
msgid "Screen will not be used next time you login."
msgstr ""
#: screen-profiles:429
#: screen-profiles:430
msgid "Escape key: ctrl-"
msgstr ""
#: screen-profiles:432
#: screen-profiles:433
msgid "Change escape sequence:"
msgstr ""
#: screen-profiles:470
#: screen-profiles:471
msgid "<Tab>/<Alt-Tab> between elements | <Return> Validates"
msgstr ""

View file

@ -3,13 +3,13 @@
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#: screen-profiles:303
#: screen-profiles:304
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-04-06 13:50-0700\n"
"POT-Creation-Date: 2009-04-07 07:50-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -57,7 +57,7 @@ msgstr ""
msgid "Exit"
msgstr ""
#: screen-profiles:87 screen-profiles:469
#: screen-profiles:87 screen-profiles:470
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:310 screen-profiles:352
#: screen-profiles:430
#: screen-profiles:185 screen-profiles:311 screen-profiles:353
#: screen-profiles:431
msgid "Cancel"
msgstr ""
#: screen-profiles:116 screen-profiles:143 screen-profiles:157
#: screen-profiles:323 screen-profiles:377 screen-profiles:385
#: screen-profiles:458
#: screen-profiles:324 screen-profiles:378 screen-profiles:386
#: screen-profiles:459
msgid "Menu"
msgstr ""
@ -82,7 +82,7 @@ msgid "Screen Profiles Help"
msgstr ""
#: screen-profiles:134 screen-profiles:150 screen-profiles:185
#: screen-profiles:310 screen-profiles:352 screen-profiles:430
#: screen-profiles:311 screen-profiles:353 screen-profiles:431
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:322
#: screen-profiles:384 screen-profiles:456
#: screen-profiles:142 screen-profiles:156 screen-profiles:323
#: screen-profiles:385 screen-profiles:457
msgid "Message"
msgstr ""
@ -119,34 +119,34 @@ msgstr ""
msgid "Create new window(s):"
msgstr ""
#: screen-profiles:311
#: screen-profiles:312
msgid "Toggle status notifications:"
msgstr ""
#: screen-profiles:344
#: screen-profiles:345
msgid "Windows:"
msgstr ""
#: screen-profiles:354
#: screen-profiles:355
msgid "Select window(s) to create by default:"
msgstr ""
#: screen-profiles:374
#: screen-profiles:375
msgid "Screen will be launched automatically next time you login."
msgstr ""
#: screen-profiles:382
#: screen-profiles:383
msgid "Screen will not be used next time you login."
msgstr ""
#: screen-profiles:429
#: screen-profiles:430
msgid "Escape key: ctrl-"
msgstr ""
#: screen-profiles:432
#: screen-profiles:433
msgid "Change escape sequence:"
msgstr ""
#: screen-profiles:470
#: screen-profiles:471
msgid "<Tab>/<Alt-Tab> between elements | <Return> Validates"
msgstr ""

View file

@ -257,15 +257,16 @@ def readstatus():
status["mem-available"]=1
status["mem-used"]=1
status["menu"]=1
status["network-up"]=0
status["network-down"]=0
status["network-up"]=0
status["processes"]=0
status["reboot-required"]=1
status["release"]=1
status["updates-available"]=1
status["users"]=0
status["updates-available"]=1
status["uptime"]=0
status["whoami"]=0
status["wifi-quality"]=0
if os.path.exists(HOME+'/.screen-profiles/status'):
f=open(HOME+'/.screen-profiles/status', 'r')
for line in f.readlines():