###############################################################################
#    Screen common profile
#      This GNU Screen configuration profile is intended to roughly
#      approximate a graphical desktop, inspired by the Ubuntu Gnome Desktop.
#
#    Copyright (C) 2008 Canonical Ltd.
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    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/>.
###############################################################################

# Now, let's override with our customizations
startup_message off
vbell off
msgwait 1
msgminwait 0
defutf8 on
deflogin on

# Define status commands
#   Use prime number intervals, to decrease collisions, which
#   yields some less expensive status updates.
#   ~86000 ~1 day
#   ~600   ~10 minutes
#   ~180   ~3 minutes
#   ~60    ~1 minute
backtick 10 	9999999	9999999		byobu-janitor
backtick 11	9999999	9999999		printf "\005-1="
backtick 12	9999999	9999999		byobu-status color

backtick 1001 	9999999	9999999		byobu-status screen_upper_left
backtick 1002 	127	127		byobu-status screen_upper_right
backtick 1003 	599	599		byobu-status screen_lower_left
backtick 1004 	2	2		byobu-status screen_lower_right

hardstatus alwayslastline

# The following line would turn off alternate Screen switching in xterms,
# so that text in Screen will go into the xterm's scrollback buffer
# and user's can press shift-pgup/shift-pgdn.
# However, alt-pgup and alt-pgdn keybindings are far more accurate,
# and handle per session/window/split scrollback correctly
termcapinfo xterm* ti@:te@
altscreen on

# Enable 256 color terminal
attrcolor b ".I"
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
defbce "on"

# Log 10000 lines
defscrollback 10000

# Set per-user exchange
bufferfile $BYOBU_RUN_DIR/printscreen
compacthist on

# Monitor windows
defmonitor on
activity ""

# Fit to the current window size, useful with F5/reloads of the profile
fit

# Maintain SSH_AUTH_SOCK link
setenv SSH_AUTH_SOCK $BYOBU_CONFIG_DIR/.ssh-agent

# Window tabs, second to last line
caption always "%1001`%?%-Lw%50L>%?%{=r}%n*%f %t%?(%u)%?%{-}%12`%?%+Lw%?%11` %=%12`%1002`%10`%<"

# Status string, last line
hardstatus string '%12`%1003`%=%1004`'

# NOTE: Older version of Screen have an arbitrary limit of only being able
# to change colors 16 times in this 'hardstatus string'.
# Ubuntu (fixed in Jaunty):
#  * https://bugs.launchpad.net/bugs/315871
# Upstream:
#  * http://savannah.gnu.org/bugs/?22146

source $BYOBU_CONFIG_DIR/keybindings
