diff --git a/bin/ip-address b/bin/ip-address new file mode 100755 index 00000000..f8e2a650 --- /dev/null +++ b/bin/ip-address @@ -0,0 +1,29 @@ +#!/bin/sh -e +# +# ip-address - report a host's ip-address +# 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 . + +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) diff --git a/debian/changelog b/debian/changelog index 7fd5f9ae..a8ebf106 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,7 @@ screen-profiles (1.51) unreleased; urgency=low * bin/cpu-freq: only print cpu-freq if available * bin/hostname: hostname -s fails sometimes, it seems * screen: respect $SCREENRC environment variable, LP: #367250 + * bin/ip-address: add an ip-address status script Detailed status * 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.1: documentation added - -- Dustin Kirkland Mon, 27 Apr 2009 21:10:40 -0500 + -- Dustin Kirkland Mon, 27 Apr 2009 21:19:03 -0500 screen-profiles (1.50-0ubuntu1) jaunty; urgency=low diff --git a/profiles/common b/profiles/common index c4e9f02b..53ab1a48 100644 --- a/profiles/common +++ b/profiles/common @@ -49,6 +49,7 @@ backtick 118 2 2 screen-profiles-status network-down backtick 119 2 2 screen-profiles-status wifi-quality backtick 120 86400 86400 screen-profiles-status date backtick 121 86400 86400 screen-profiles-status time +backtick 122 3600 3600 screen-profiles-status ip-address hardstatus alwayslastline diff --git a/profiles/profile.skel b/profiles/profile.skel index 6d288dc2..8f07abf0 100644 --- a/profiles/profile.skel +++ b/profiles/profile.skel @@ -23,7 +23,7 @@ source /usr/share/screen-profiles/profiles/common # 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 hardstatus string '%99`%{= Wk} %100`%112`%= %102`%101`%114`%115`%108`%113`%119`%117`%118`%116`%106`%104`%103`%105`%107`%120`%121`' diff --git a/screen-profiles b/screen-profiles index b9ea907a..3dc18a08 100755 --- a/screen-profiles +++ b/screen-profiles @@ -250,6 +250,7 @@ def readstatus(): status["date"]=1 status["ec2-cost"]=0 status["hostname"]=0 + status["ip-address"]=0 status["load-average"]=1 status["logo"]=1 status["mem-available"]=1 diff --git a/screen-profiles-status b/screen-profiles-status index 951f9b06..0a4407c8 100755 --- a/screen-profiles-status +++ b/screen-profiles-status @@ -42,7 +42,7 @@ case "$P" in grep -qs -m1 "^$P=0$" "$HOME/.screen-profiles/status" && exit 0 ;; # 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 ;; --detail) diff --git a/screen-profiles-status-detail b/screen-profiles-status-detail new file mode 100755 index 00000000..337eb754 --- /dev/null +++ b/screen-profiles-status-detail @@ -0,0 +1,32 @@ +#!/bin/sh +# +# screen-profiles-status-detail +# 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 . + +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