diff --git a/debian/changelog b/debian/changelog index 398c1deb..f6a9b507 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,12 @@ screen-profiles (1.0) jaunty; urgency=low - + [ Dustin Kirkland ] * Initial upload + - ubuntu, debian, redhat, fedora profiles + - select-screen-profile utility - -- Dustin Kirkland 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 Mon, 15 Dec 2008 23:02:09 -0600 diff --git a/debian/install b/debian/install index e66b48d6..c6cc6e00 100644 --- a/debian/install +++ b/debian/install @@ -2,6 +2,7 @@ bin/cpu-freq usr/share/screen-profiles/bin bin/reboot-required usr/share/screen-profiles/bin bin/release 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/ubuntu.screenrc usr/share/screen-profiles/profiles select-screen-profile usr/bin diff --git a/profiles/common b/profiles/common new file mode 100644 index 00000000..0e1ee638 --- /dev/null +++ b/profiles/common @@ -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 +# +# 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 . +############################################################################### + +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 diff --git a/profiles/debian.screenrc b/profiles/debian.screenrc index 111f4e55..ee2e9cee 100644 --- a/profiles/debian.screenrc +++ b/profiles/debian.screenrc @@ -19,16 +19,7 @@ # along with this program. If not, see . ############################################################################### -startup_message off -msgwait 1 +source /usr/share/screen-profiles/profiles/common -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}' 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 diff --git a/profiles/fedora.screenrc b/profiles/fedora.screenrc index 98f1d322..3b457e6d 100644 --- a/profiles/fedora.screenrc +++ b/profiles/fedora.screenrc @@ -19,14 +19,7 @@ # along with this program. If not, see . ############################################################################### -startup_message off -msgwait 1 +source /usr/share/screen-profiles/profiles/common -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}' hardstatus string '%{= wk} %{+b Bw} f %{+b wk} %100` %{= Wk}|%= |%{+b gW}%103`%{= Wk}|%{= wb}%Y-%m-%d %c:%s%{k}' - -# Keybindings diff --git a/profiles/redhat.screenrc b/profiles/redhat.screenrc index 495375ce..ede7d6af 100644 --- a/profiles/redhat.screenrc +++ b/profiles/redhat.screenrc @@ -19,14 +19,8 @@ # along with this program. If not, see . ############################################################################### -startup_message off -msgwait 1 - -backtick 100 3600 3600 /usr/share/screen-profiles/bin/release -backtick 103 5 5 /usr/share/screen-profiles/bin/cpu-freq +source /usr/share/screen-profiles/profiles/common hardstatus alwayslastline 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}' - -# Keybindings diff --git a/profiles/ubuntu.screenrc b/profiles/ubuntu.screenrc index 9b12e84a..a7a9ee2d 100644 --- a/profiles/ubuntu.screenrc +++ b/profiles/ubuntu.screenrc @@ -19,16 +19,7 @@ # along with this program. If not, see . ############################################################################### -startup_message off -msgwait 1 +source /usr/share/screen-profiles/profiles/common -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}' 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 diff --git a/select-screen-profile b/select-screen-profile index 28676b5b..4c89fea8 100755 --- a/select-screen-profile +++ b/select-screen-profile @@ -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 - if [ ! -L "$HOME/.screenrc" ]; then - echo `gettext 'Error:'` $HOME/.screenrc `gettext 'exists, but is not a symlink'` +# Ensure that ~/.screenrc-profile is a symbolic link +if [ -e "$HOME/.screenrc-profile" ]; then + if [ ! -L "$HOME/.screenrc-profile" ]; then + echo `gettext 'Error:'` $HOME/.screenrc-profile `gettext 'exists, but is not a symlink'` exit 1 fi fi +# Prompt the user to choose among the available profiles echo echo "Select a screen profile: " i=0 @@ -40,7 +43,23 @@ i=0 for x in $profiles; do i=`expr $i + 1` 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 done