added an ip-address status script

Signed-off-by: Dustin Kirkland <kirkland@canonical.com>
This commit is contained in:
Dustin Kirkland 2009-04-27 21:30:12 -05:00
commit 69ada3914a
7 changed files with 67 additions and 3 deletions

29
bin/ip-address Executable file
View file

@ -0,0 +1,29 @@
#!/bin/sh -e
#
# ip-address - report a host's ip-address
# 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/>.
if [ "$1" = "--detail" ]; then
hostname -i
exit 0
fi
space=
grep -qs "^hostname=1$" "$HOME/.screen-profiles/status" && space=" "
grep -qs "^whoami=1$" "$HOME/.screen-profiles/status" && space=" "
printf "\005{=b }%s%s\005{-}" "$space" $(hostname -i 2>/dev/null)

3
debian/changelog vendored
View file

@ -3,6 +3,7 @@ screen-profiles (1.51) unreleased; urgency=low
* bin/cpu-freq: only print cpu-freq if available * bin/cpu-freq: only print cpu-freq if available
* bin/hostname: hostname -s fails sometimes, it seems * bin/hostname: hostname -s fails sometimes, it seems
* screen: respect $SCREENRC environment variable, LP: #367250 * screen: respect $SCREENRC environment variable, LP: #367250
* bin/ip-address: add an ip-address status script
Detailed status Detailed status
* bin/*: add special actions if --detail is specified; basically, * bin/*: add special actions if --detail is specified; basically,
@ -12,7 +13,7 @@ screen-profiles (1.51) unreleased; urgency=low
* screen-profiles-status-detail: wrapper using sensible-pager * screen-profiles-status-detail: wrapper using sensible-pager
* screen-profiles-status-detail.1: documentation added * screen-profiles-status-detail.1: documentation added
-- Dustin Kirkland <kirkland@ubuntu.com> Mon, 27 Apr 2009 21:10:40 -0500 -- Dustin Kirkland <kirkland@ubuntu.com> Mon, 27 Apr 2009 21:19:03 -0500
screen-profiles (1.50-0ubuntu1) jaunty; urgency=low screen-profiles (1.50-0ubuntu1) jaunty; urgency=low

View file

@ -49,6 +49,7 @@ backtick 118 2 2 screen-profiles-status network-down
backtick 119 2 2 screen-profiles-status wifi-quality backtick 119 2 2 screen-profiles-status wifi-quality
backtick 120 86400 86400 screen-profiles-status date backtick 120 86400 86400 screen-profiles-status date
backtick 121 86400 86400 screen-profiles-status time backtick 121 86400 86400 screen-profiles-status time
backtick 122 3600 3600 screen-profiles-status ip-address
hardstatus alwayslastline hardstatus alwayslastline

View file

@ -23,7 +23,7 @@
source /usr/share/screen-profiles/profiles/common source /usr/share/screen-profiles/profiles/common
# Window tabs, second to last line # Window tabs, second to last line
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`%122`"
# Status string, last line # Status string, last line
hardstatus string '%99`%{= Wk} %100`%112`%= %102`%101`%114`%115`%108`%113`%119`%117`%118`%116`%106`%104`%103`%105`%107`%120`%121`' hardstatus string '%99`%{= Wk} %100`%112`%= %102`%101`%114`%115`%108`%113`%119`%117`%118`%116`%106`%104`%103`%105`%107`%120`%121`'

View file

@ -250,6 +250,7 @@ def readstatus():
status["date"]=1 status["date"]=1
status["ec2-cost"]=0 status["ec2-cost"]=0
status["hostname"]=0 status["hostname"]=0
status["ip-address"]=0
status["load-average"]=1 status["load-average"]=1
status["logo"]=1 status["logo"]=1
status["mem-available"]=1 status["mem-available"]=1

View file

@ -42,7 +42,7 @@ case "$P" in
grep -qs -m1 "^$P=0$" "$HOME/.screen-profiles/status" && exit 0 grep -qs -m1 "^$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|users|whoami|wifi-quality) arch|battery|ec2-cost|hostname|ip-address|network-down|network-up|processes|users|whoami|wifi-quality)
grep -qs -m1 "^$P=1$" "$HOME/.screen-profiles/status" || exit 0 grep -qs -m1 "^$P=1$" "$HOME/.screen-profiles/status" || exit 0
;; ;;
--detail) --detail)

32
screen-profiles-status-detail Executable file
View file

@ -0,0 +1,32 @@
#!/bin/sh
#
# screen-profiles-status-detail
# 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/>.
pager=
for i in "sensible-pager" "less" "more"; do
if which "$i" >/dev/null 2>&1; then
pager="$i"
break
fi
done
if [ -n "$pager" ]; then
screen-profiles-status --detail | $pager
else
screen-profiles-status --detail
fi