bin/logo, profiles/common: dynamically print logo

This commit is contained in:
Dustin Kirkland 2009-03-31 16:48:32 -05:00
commit 2163f36a18
5 changed files with 66 additions and 2 deletions

61
bin/logo Executable file
View file

@ -0,0 +1,61 @@
#!/bin/sh -e
#
# logo: determine which logo to use
# 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 on
p="logo"
grep -qs "^$p=0$" "$HOME/.screen-profiles/status" && exit 0
if [ -r "$HOME/.screen-profiles/distro" ]; then
# Allow manual override
distro=`cat "$HOME/.screen-profiles/distro"`
elif which lsb_release >/dev/null; then
# If lsb_release is available, use it
distro=`lsb_release -s -a 2>/dev/null`
elif [ -r "/etc/issue" ]; then
# Otherwise, grab part of /etc/issue
distro=`cat /etc/issue`
else
# No idea!
distro="Unknown"
fi
if echo "$distro" | grep -qsi "ubuntu"; then
printf "\005{=b kr}\\\\\005{= ky}o\005{=b kY}/"
elif echo "$distro" | grep -qsi "arch"; then
printf "\005{=b wb} A "
elif echo "$distro" | grep -qsi "centos"; then
printf "\005{= gw}*\005{= mw}*\005{= yw}*\005{= bw}*%{=b Wk}"
elif echo "$distro" | grep -qsi "debian"; then
printf "\005{= wr} @ "
elif echo "$distro" | grep -qsi "fedora"; then
printf "\005{=b bw} f "
elif echo "$distro" | grep -qsi "gentoo"; then
printf "\005{=b cw} > "
elif echo "$distro" | grep -qsi "mandriva"; then
printf "\005{=b kc} (\005{=b ky}* "
elif echo "$distro" | grep -qsi "redhat"; then
printf "\005{=b rk} RH "
elif echo "$distro" | grep -qsi "slackware"; then
printf "\005{=u Bk},S "
elif echo "$distro" | grep -qsi "suse"; then
printf "\005{= Wg}SuSE"
else
printf " ? "
fi
exit 0

3
debian/changelog vendored
View file

@ -9,6 +9,7 @@ screen-profiles (1.42) unreleased; urgency=low
* po/*: screen-profiles-export translation template * po/*: screen-profiles-export translation template
* profiles/common: added 'altscreen on', which cleans the screen for * profiles/common: added 'altscreen on', which cleans the screen for
programs that support this, such as vi and emacs, LP: #349677 programs that support this, such as vi and emacs, LP: #349677
* bin/logo, profiles/common: dynamically print logo
[ Adi Roiban ] [ Adi Roiban ]
* debian/install, debian/rules, po/POTFILES.python, po/POTFILES.sh, * debian/install, debian/rules, po/POTFILES.python, po/POTFILES.sh,
@ -16,7 +17,7 @@ screen-profiles (1.42) unreleased; urgency=low
in the screen-profiles build and install in the screen-profiles build and install
-- Dustin Kirkland <kirkland@ubuntu.com> Tue, 31 Mar 2009 15:54:30 -0500 -- Dustin Kirkland <kirkland@ubuntu.com> Tue, 31 Mar 2009 16:40:00 -0500
screen-profiles (1.41-0ubuntu1) jaunty; urgency=low screen-profiles (1.41-0ubuntu1) jaunty; urgency=low

View file

@ -26,6 +26,7 @@ vbell off
msgwait 1 msgwait 1
# Define status commands # Define status commands
backtick 99 86400 86400 /var/lib/screen-profiles/logo
backtick 100 3600 3600 /var/lib/screen-profiles/release backtick 100 3600 3600 /var/lib/screen-profiles/release
backtick 101 10 10 /var/lib/screen-profiles/updates-available backtick 101 10 10 /var/lib/screen-profiles/updates-available
backtick 102 2 2 /var/lib/screen-profiles/reboot-required backtick 102 2 2 /var/lib/screen-profiles/reboot-required

View file

@ -26,7 +26,7 @@ source /usr/share/screen-profiles/profiles/common
caption always "%{kW}%?%-Lw%?%{bw}%n*%f %t%?(%u)%?%{kW}%?%+Lw%? %= %{=b Wk}%110`%109` %{= kw}%111`" caption always "%{kW}%?%-Lw%?%{bw}%n*%f %t%?(%u)%?%{kW}%?%+Lw%? %= %{=b Wk}%110`%109` %{= kw}%111`"
# Status string, last line # Status string, last line
hardstatus string '__LOGO__%{=b Wk} %100` %{= Wk}%112` %= %{=b bW}%102`%{= Wk} %{=b rW}%101`%{= Wk} %{= Wg}%108`%{= Wk} %{= Yk}%106`%{= Wk} %{= Wk}%104`%{=b cW}%103`%{= Wk} %{=b gW}%105`%107`%{= Wk} %Y-%m-%d %0c:%s' hardstatus string '%99`%{=b Wk} %100` %{= Wk}%112` %= %{=b bW}%102`%{= Wk} %{=b rW}%101`%{= Wk} %{= Wg}%108`%{= Wk} %{= Yk}%106`%{= Wk} %{= Wk}%104`%{=b cW}%103`%{= Wk} %{=b gW}%105`%107`%{= Wk} %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

@ -252,6 +252,7 @@ def readstatus():
status["ec2-cost"]=0 status["ec2-cost"]=0
status["hostname"]=0 status["hostname"]=0
status["load-average"]=1 status["load-average"]=1
status["logo"]=1
status["mem-available"]=1 status["mem-available"]=1
status["mem-used"]=1 status["mem-used"]=1
status["menu"]=1 status["menu"]=1