bin/wifi-quality: show wireless signal quality

use screen-profiles-status for calling status scripts
This commit is contained in:
Dustin Kirkland 2009-04-06 13:55:07 -07:00
commit e6211956f2
10 changed files with 74 additions and 30 deletions

25
bin/wifi-quality Executable file
View file

@ -0,0 +1,25 @@
#!/bin/sh -e
#
# wifi-quality: display wifi signal quality
# Copyright (C) 2008 Canonical Ltd.
#
# Authors: Dustin Kirkland <kirkland@canonical.com>
#
# 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 <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/^.* //"`
iwconfig "$interface" 2>/dev/null | grep "Link Quality=" | sed "s/^.*Link Quality=//" | sed "s/ .*$//g" | awk '{printf "\005{=b Ck}%.0f\005{-}\005{= Ck}%%)))\005{-} ", $1}' || exit 0

3
debian/changelog vendored
View file

@ -4,6 +4,7 @@ screen-profiles (1.43) unreleased; urgency=low
* bin/logo: allow users to define their own logo * bin/logo: allow users to define their own logo
* bin/processes: displace a count of the running processes * bin/processes: displace a count of the running processes
* bin/network-down, bin/network-up: added network transmit status * bin/network-down, bin/network-up: added network transmit status
* bin/wifi-quality: show wireless signal quality
* bin/*, profiles/profile.skel: make all status scripts handle their * bin/*, profiles/profile.skel: make all status scripts handle their
own colors and trailing whitespace; this should help alleviate the own colors and trailing whitespace; this should help alleviate the
16-color-change limitation on un-patched screens; it also simplifies 16-color-change limitation on un-patched screens; it also simplifies
@ -20,7 +21,7 @@ screen-profiles (1.43) unreleased; urgency=low
added new status items for battery state, number of users, and system added new status items for battery state, number of users, and system
uptime uptime
-- Dustin Kirkland <kirkland@ubuntu.com> Sat, 04 Apr 2009 22:44:27 -0700 -- Dustin Kirkland <kirkland@ubuntu.com> Mon, 06 Apr 2009 13:52:30 -0700
screen-profiles (1.42-0ubuntu1) jaunty; urgency=low screen-profiles (1.42-0ubuntu1) jaunty; urgency=low

1
debian/install vendored
View file

@ -11,6 +11,7 @@ windows/common usr/share/screen-profiles/windows
screen usr/bin screen usr/bin
select-screen-profile usr/bin select-screen-profile usr/bin
screen-profiles usr/bin screen-profiles usr/bin
screen-profiles-status usr/bin
screen-launcher-install usr/share/screen-profiles screen-launcher-install usr/share/screen-profiles
screen-launcher-uninstall usr/share/screen-profiles screen-launcher-uninstall usr/share/screen-profiles
motd+shell usr/bin motd+shell usr/bin

View file

@ -9,7 +9,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: 1.0\n" "Project-Id-Version: 1.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-04-04 11:09-0700\n" "POT-Creation-Date: 2009-04-06 13:50-0700\n"
"PO-Revision-Date: 2008-12-22 01:01-0500\n" "PO-Revision-Date: 2008-12-22 01:01-0500\n"
"Last-Translator: Nicolas Valcarcel <nvalcarcel@ubuntu.com>\n" "Last-Translator: Nicolas Valcarcel <nvalcarcel@ubuntu.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"

View file

@ -9,7 +9,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: 1.0\n" "Project-Id-Version: 1.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-04-04 11:09-0700\n" "POT-Creation-Date: 2009-04-06 13:50-0700\n"
"PO-Revision-Date: 2008-12-17 23:42+0100\n" "PO-Revision-Date: 2008-12-17 23:42+0100\n"
"Last-Translator: Nicolas Barcet <nicolas.barcet@ubuntu.com>\n" "Last-Translator: Nicolas Barcet <nicolas.barcet@ubuntu.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"

View file

@ -9,7 +9,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-04-04 11:09-0700\n" "POT-Creation-Date: 2009-04-06 13:50-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"

View file

@ -26,26 +26,27 @@ vbell off
msgwait 1 msgwait 1
# Define status commands # Define status commands
backtick 99 86400 86400 /var/lib/screen-profiles/logo backtick 99 86400 86400 screen-profiles-status logo
backtick 100 3600 3600 /var/lib/screen-profiles/release backtick 100 3600 3600 screen-profiles-status release
backtick 101 10 10 /var/lib/screen-profiles/updates-available backtick 101 10 10 screen-profiles-status updates-available
backtick 102 2 2 /var/lib/screen-profiles/reboot-required backtick 102 2 2 screen-profiles-status reboot-required
backtick 103 2 2 /var/lib/screen-profiles/cpu-freq backtick 103 2 2 screen-profiles-status cpu-freq
backtick 104 86400 86400 /var/lib/screen-profiles/cpu-count backtick 104 86400 86400 screen-profiles-status cpu-count
backtick 105 86400 86400 /var/lib/screen-profiles/mem-available backtick 105 86400 86400 screen-profiles-status mem-available
backtick 106 2 2 /var/lib/screen-profiles/load-average backtick 106 2 2 screen-profiles-status load-average
backtick 107 2 2 /var/lib/screen-profiles/mem-used backtick 107 2 2 screen-profiles-status mem-used
backtick 108 600 600 /var/lib/screen-profiles/ec2-cost backtick 108 600 600 screen-profiles-status ec2-cost
backtick 109 3600 3600 /var/lib/screen-profiles/hostname backtick 109 3600 3600 screen-profiles-status hostname
backtick 110 86400 86400 /var/lib/screen-profiles/whoami backtick 110 86400 86400 screen-profiles-status whoami
backtick 111 86400 86400 /var/lib/screen-profiles/menu backtick 111 86400 86400 screen-profiles-status menu
backtick 112 86400 86400 /var/lib/screen-profiles/arch backtick 112 86400 86400 screen-profiles-status arch
backtick 113 30 30 /var/lib/screen-profiles/battery backtick 113 30 30 screen-profiles-status battery
backtick 114 10 10 /var/lib/screen-profiles/users backtick 114 10 10 screen-profiles-status users
backtick 115 60 60 /var/lib/screen-profiles/uptime backtick 115 60 60 screen-profiles-status uptime
backtick 116 2 2 /var/lib/screen-profiles/processes backtick 116 2 2 screen-profiles-status processes
backtick 117 2 2 /var/lib/screen-profiles/network-up backtick 117 2 2 screen-profiles-status network-up
backtick 118 2 2 /var/lib/screen-profiles/network-down backtick 118 2 2 screen-profiles-status network-down
backtick 119 2 2 screen-profiles-status wifi-quality
hardstatus alwayslastline hardstatus alwayslastline

View file

@ -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`" caption always "%{kW}%?%-Lw%?%{bw}%n*%f %t%?(%u)%?%{kW}%?%+Lw%? %= %{= Wk}%110`%109`%111`"
# Status string, last line # Status string, last line
hardstatus string '%{= Wk}%99`%{= Wk} %100`%112`%102`%101`%= %115`%114`%108`%113`%117`%118`%116`%106`%104`%103`%105`%107`%Y-%m-%d %0c:%s' hardstatus string '%{= Wk}%99`%{= Wk} %100`%112`%102`%101`%= %115`%114`%108`%113`%119`%117`%118`%116`%106`%104`%103`%105`%107`%Y-%m-%d %0c:%s'
# NOTE: Older version of screen have an arbitrary limit of only being able # NOTE: Older version of screen have an arbitrary limit of only being able
# to change colors 16 times in this 'hardstatus string'. # to change colors 16 times in this 'hardstatus string'.

View file

@ -124,9 +124,9 @@ header() {
} }
sources() { sources() {
# insert the common profile, replace the /var/lib exe path # insert the common profile, replace the status exe path
echo echo
cat $SHARE/profiles/common | sed "s:/var/lib/$PROG/:\$HOME/.$PROG/bin/:" cat $SHARE/profiles/common | sed "s:$PROG-status:\$HOME/.$PROG/$PROG-status:"
hr hr
echo echo
cat $SHARE/keybindings/common cat $SHARE/keybindings/common
@ -161,7 +161,15 @@ done
[ -z "$file" ] && usage [ -z "$file" ] && usage
echo "$file" | grep -qs "\.tar\.gz$" || error "Target file must be a '.tar.gz' archive" echo "$file" | grep -qs "\.tar\.gz$" || error "Target file must be a '.tar.gz' archive"
[ -e "$file" ] && error "File exists, please remove before running [$file]" if [ -e "$file" ]; then
echo `gettext "File exists"` " [$file]"
read -p "`gettext 'Remove file? [y/N] '`" -r remove
if [ "$remove" = "Y" -o "$remove" = "y" ]; then
rm -f "$file"
else
exit 1
fi
fi
# Obtain selections # Obtain selections
count=1 count=1
@ -195,6 +203,7 @@ mkdir -p "$TMPDIR/.$PROG/bin"
# Copy status scripts # Copy status scripts
cp -a /var/lib/$PROG/* "$TMPDIR/.$PROG/bin" cp -a /var/lib/$PROG/* "$TMPDIR/.$PROG/bin"
cp -a /usr/bin/$PROG-status "$TMPDIR/.$PROG"
# Generate the monolithic profile # Generate the monolithic profile
header > "$PROFILE" header > "$PROFILE"

View file

@ -21,7 +21,14 @@
renice 10 $$ >/dev/null 2>&1 || true renice 10 $$ >/dev/null 2>&1 || true
ionice -c3 -p $$ >/dev/null 2>&1 || true ionice -c3 -p $$ >/dev/null 2>&1 || true
if [ -d "/var/lib/screen-profiles" ]; then
DIR="/var/lib/screen-profiles" DIR="/var/lib/screen-profiles"
elif [ -d "$HOME/.screen-profiles/bin" ]; then
DIR="$HOME/.screen-profiles/bin"
else
exit 1
fi
P="$1" P="$1"
case "$P" in case "$P" in
@ -30,7 +37,7 @@ case "$P" in
grep -qs "^$P=0$" "$HOME/.screen-profiles/status" && exit 0 grep -qs "^$P=0$" "$HOME/.screen-profiles/status" && exit 0
;; ;;
# default = off, user must override to turn on # default = off, user must override to turn on
arch|battery|ec2-cost|hostname|network-down|network-up|processes|uptime|users|whoami) arch|battery|ec2-cost|hostname|network-down|network-up|processes|uptime|users|whoami|wifi-quality)
grep -qs "^$P=1$" "$HOME/.screen-profiles/status" || exit 0 grep -qs "^$P=1$" "$HOME/.screen-profiles/status" || exit 0
;; ;;
*) *)