* merge from nijaba

* extracted common functionality out of each profile, added to common file,
   now sourced by each profile
 * select-screen-profile now supports user customizations
This commit is contained in:
Dustin Kirkland 2008-12-15 23:10:03 -06:00
commit 18949575ad
8 changed files with 79 additions and 43 deletions

11
debian/changelog vendored
View file

@ -1,5 +1,12 @@
screen-profiles (1.0) jaunty; urgency=low screen-profiles (1.0) jaunty; urgency=low
[ Dustin Kirkland ]
* Initial upload * Initial upload
- ubuntu, debian, redhat, fedora profiles
- select-screen-profile utility
-- Dustin Kirkland <kirkland@ubuntu.com> Sun, 14 Dec 2008 13:12:12 -0600
[ Nicolas Barcet ]
* Allow local modification of .screenrc (LP: #308216)
* Add some nice defaults to ubuntu.screenrc
-- Dustin Kirkland <kirkland@ubuntu.com> Mon, 15 Dec 2008 23:02:09 -0600

1
debian/install vendored
View file

@ -2,6 +2,7 @@ bin/cpu-freq usr/share/screen-profiles/bin
bin/reboot-required usr/share/screen-profiles/bin bin/reboot-required usr/share/screen-profiles/bin
bin/release usr/share/screen-profiles/bin bin/release usr/share/screen-profiles/bin
bin/updates-available usr/share/screen-profiles/bin bin/updates-available usr/share/screen-profiles/bin
profiles/common usr/share/screen-profiles/profiles
profiles/debian.screenrc usr/share/screen-profiles/profiles profiles/debian.screenrc usr/share/screen-profiles/profiles
profiles/ubuntu.screenrc usr/share/screen-profiles/profiles profiles/ubuntu.screenrc usr/share/screen-profiles/profiles
select-screen-profile usr/bin select-screen-profile usr/bin

40
profiles/common Normal file
View file

@ -0,0 +1,40 @@
###############################################################################
# GNU Screen common profile
# This configuration profile is intended to be a common header of useful
# functionality, included by other profiles.
#
# Copyright (C) 2008 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, either version 3 of the License, or
# (at your option) any later version.
#
# 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/>.
###############################################################################
startup_message off
msgwait 1
backtick 100 3600 3600 /usr/share/screen-profiles/bin/release
backtick 101 3600 3600 /usr/share/screen-profiles/bin/updates-available
backtick 102 10 10 /usr/share/screen-profiles/bin/reboot-required
backtick 103 5 5 /usr/share/screen-profiles/bin/cpu-freq
hardstatus alwayslastline
# Allow scrolling in xterm
termcapinfo xterm ti@:te@
# Keybindings
# Map shift-tab to go to next window
bindkey "\033[Z" next
# Ctrl+PgUp and Ctrl+PgDn to change windows
bindkey ^[[5;5~ prev
bindkey ^[[6;5~ next

View file

@ -19,16 +19,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
############################################################################### ###############################################################################
startup_message off source /usr/share/screen-profiles/profiles/common
msgwait 1
backtick 100 3600 3600 /usr/share/screen-profiles/bin/release
backtick 101 3600 3600 /usr/share/screen-profiles/bin/updates-available
backtick 102 10 10 /usr/share/screen-profiles/bin/reboot-required
backtick 103 5 5 /usr/share/screen-profiles/bin/cpu-freq
hardstatus alwayslastline
caption always '%{= Wk}%{= Wk}%?%-Lw%?%{= yk}%n %t%{= Wk} %?%+Lw%?%?%= %{= Wk}' caption always '%{= Wk}%{= Wk}%?%-Lw%?%{= yk}%n %t%{= Wk} %?%+Lw%?%?%= %{= Wk}'
hardstatus string '%{= wk} %{+b Wr} @ %{+b wk} %100` %{= Wk}|%= |%{+B bW}%102`%{= Wk}|%{+b rW}%101`%{= Wk}|%{+b gW}%103`%{= Wk}|%{= wb}%Y-%m-%d %c:%s%{k}' hardstatus string '%{= wk} %{+b Wr} @ %{+b wk} %100` %{= Wk}|%= |%{+B bW}%102`%{= Wk}|%{+b rW}%101`%{= Wk}|%{+b gW}%103`%{= Wk}|%{= wb}%Y-%m-%d %c:%s%{k}'
# Keybindings

View file

@ -19,14 +19,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
############################################################################### ###############################################################################
startup_message off source /usr/share/screen-profiles/profiles/common
msgwait 1
backtick 100 3600 3600 /usr/share/screen-profiles/bin/release
backtick 103 5 5 /usr/share/screen-profiles/bin/cpu-freq
hardstatus alwayslastline
caption always '%{= Wk}%{= Wk}%?%-Lw%?%{= yk}%n %t%{= Wk} %?%+Lw%?%?%= %{= Wk}' caption always '%{= Wk}%{= Wk}%?%-Lw%?%{= yk}%n %t%{= Wk} %?%+Lw%?%?%= %{= Wk}'
hardstatus string '%{= wk} %{+b Bw} f %{+b wk} %100` %{= Wk}|%= |%{+b gW}%103`%{= Wk}|%{= wb}%Y-%m-%d %c:%s%{k}' hardstatus string '%{= wk} %{+b Bw} f %{+b wk} %100` %{= Wk}|%= |%{+b gW}%103`%{= Wk}|%{= wb}%Y-%m-%d %c:%s%{k}'
# Keybindings

View file

@ -19,14 +19,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
############################################################################### ###############################################################################
startup_message off source /usr/share/screen-profiles/profiles/common
msgwait 1
backtick 100 3600 3600 /usr/share/screen-profiles/bin/release
backtick 103 5 5 /usr/share/screen-profiles/bin/cpu-freq
hardstatus alwayslastline hardstatus alwayslastline
caption always '%{= Wk}%{= Wk}%?%-Lw%?%{= yk}%n %t%{= Wk} %?%+Lw%?%?%= %{= Wk}' caption always '%{= Wk}%{= Wk}%?%-Lw%?%{= yk}%n %t%{= Wk} %?%+Lw%?%?%= %{= Wk}'
hardstatus string '%{= wk} %{+b RK} RH %{+b wk} %100` %{= Wk}|%= |%{+b gW}%103`%{= Wk}|%{= wb}%Y-%m-%d %c:%s%{k}' hardstatus string '%{= wk} %{+b RK} RH %{+b wk} %100` %{= Wk}|%= |%{+b gW}%103`%{= Wk}|%{= wb}%Y-%m-%d %c:%s%{k}'
# Keybindings

View file

@ -19,16 +19,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
############################################################################### ###############################################################################
startup_message off source /usr/share/screen-profiles/profiles/common
msgwait 1
backtick 100 3600 3600 /usr/share/screen-profiles/bin/release
backtick 101 3600 3600 /usr/share/screen-profiles/bin/updates-available
backtick 102 10 10 /usr/share/screen-profiles/bin/reboot-required
backtick 103 5 5 /usr/share/screen-profiles/bin/cpu-freq
hardstatus alwayslastline
caption always '%{= Wk}%{= Wk}%?%-Lw%?%{= yk}%n %t%{= Wk} %?%+Lw%?%?%= %{= Wk}' caption always '%{= Wk}%{= Wk}%?%-Lw%?%{= yk}%n %t%{= Wk} %?%+Lw%?%?%= %{= Wk}'
hardstatus string '%{= wk} %{+b r}\%{= y}o%{=b Y}/%{+b wk} %100` %{= Wk}|%= |%{+B bW}%102`%{= Wk}|%{+b rW}%101`%{= Wk}|%{+b gW}%103`%{= Wk}|%{= wb}%Y-%m-%d %c:%s%{k}' hardstatus string '%{= wk} %{+b r}\%{= y}o%{=b Y}/%{+b wk} %100` %{= Wk}|%= |%{+B bW}%102`%{= Wk}|%{+b rW}%101`%{= Wk}|%{+b gW}%103`%{= Wk}|%{= wb}%Y-%m-%d %c:%s%{k}'
# Keybindings

View file

@ -1,14 +1,17 @@
#!/bin/sh #!/bin/sh -e
PROFILE_DIR="/usr/share/screen-profiles/profiles" BASE_DIR="/usr/share/screen-profiles"
PROFILE_DIR="$BASE_DIR/profiles"
if [ -e "$HOME/.screenrc" ]; then # Ensure that ~/.screenrc-profile is a symbolic link
if [ ! -L "$HOME/.screenrc" ]; then if [ -e "$HOME/.screenrc-profile" ]; then
echo `gettext 'Error:'` $HOME/.screenrc `gettext 'exists, but is not a symlink'` if [ ! -L "$HOME/.screenrc-profile" ]; then
echo `gettext 'Error:'` $HOME/.screenrc-profile `gettext 'exists, but is not a symlink'`
exit 1 exit 1
fi fi
fi fi
# Prompt the user to choose among the available profiles
echo echo
echo "Select a screen profile: " echo "Select a screen profile: "
i=0 i=0
@ -40,7 +43,23 @@ i=0
for x in $profiles; do for x in $profiles; do
i=`expr $i + 1` i=`expr $i + 1`
if [ $i -eq $selected ]; then if [ $i -eq $selected ]; then
rm -f "$HOME/.screenrc" && ln -s "$PROFILE_DIR/$x" "$HOME/.screenrc" if [ ! -e "$HOME/.screenrc" ]; then
# If the user doesn't have a .screenrc, seed one
echo "source ~/.screenrc-profile" > "$HOME/.screenrc"
else
# If the user does have a .screenrc, see if it has the
# source line
if ! grep -qs "source $HOME/.screenrc-profile" "$HOME/.screenrc"; then
# And if it's missing the source line, add it
# to the top
tmp=`mktemp "$HOME/.screenrc.XXXXXX"`
echo "source $HOME/.screenrc-profile" > "$tmp"
cat "$HOME/.screenrc" >> "$tmp"
mv -f "$tmp" "$HOME/.screenrc"
fi
fi
rm -f "$HOME/.screenrc-profile"
ln -s "$PROFILE_DIR/$x" "$HOME/.screenrc-profile"
fi fi
done done