allow the user to override our term choices, by setting

BYOBU_TERM, BYOBU_DEFAULT_TERM and/or BYOBU_COLOR_TERM
This commit is contained in:
Jeffery To 2016-08-06 16:43:09 +08:00
commit b0e08593b6
2 changed files with 17 additions and 7 deletions

2
debian/changelog vendored
View file

@ -3,6 +3,8 @@ byobu (5.111) unreleased; urgency=medium
[ Jeffery To ] [ Jeffery To ]
* usr/bin/byobu.in, usr/share/byobu/profiles/tmux: * usr/bin/byobu.in, usr/share/byobu/profiles/tmux:
- use screen-256color if possible, for both screen and tmux - use screen-256color if possible, for both screen and tmux
- allow the user to override our term choices, by setting
BYOBU_TERM, BYOBU_DEFAULT_TERM and/or BYOBU_COLOR_TERM
-- Dustin Kirkland <kirkland@ubuntu.com> Fri, 29 Jul 2016 12:29:07 -0500 -- Dustin Kirkland <kirkland@ubuntu.com> Fri, 29 Jul 2016 12:29:07 -0500

View file

@ -109,11 +109,11 @@ if [ -S "$SSH_AUTH_SOCK" ] && [ ! -h "$SSH_AUTH_SOCK" ]; then
export SSH_AUTH_SOCK="$BYOBU_CONFIG_DIR/.ssh-agent" export SSH_AUTH_SOCK="$BYOBU_CONFIG_DIR/.ssh-agent"
fi fi
# Terminfo we will use # Fallback terminfo
BYOBU_TERM="screen" [ -z "$BYOBU_DEFAULT_TERM" ] && BYOBU_DEFAULT_TERM="screen"
# Color terminfo to use, if possible # Color terminfo to use, if possible
BYOBU_COLOR_TERM="screen-256color" [ -z "$BYOBU_COLOR_TERM" ] && BYOBU_COLOR_TERM="screen-256color"
# Check if our terminfo supports 256 colors # Check if our terminfo supports 256 colors
CAN_SHOW_COLORS= CAN_SHOW_COLORS=
@ -137,8 +137,12 @@ case $BYOBU_BACKEND in
if [ -n "$CAN_SHOW_COLORS" ] || [ "$COLORTERM" = "gnome-terminal" ] || [ "$TERM" = "xterm" ] || [ "$TERM" = "xterm-256color" ] || [ "$TERM" = "screen" ]; then if [ -n "$CAN_SHOW_COLORS" ] || [ "$COLORTERM" = "gnome-terminal" ] || [ "$TERM" = "xterm" ] || [ "$TERM" = "xterm-256color" ] || [ "$TERM" = "screen" ]; then
[ -z "$SCREEN_TERM" ] && SCREEN_TERM="-2" [ -z "$SCREEN_TERM" ] && SCREEN_TERM="-2"
fi fi
if [ -z "$BYOBU_TERM" ]; then
if [ -n "$SCREEN_TERM" -a -n "$HAS_COLOR_TERM" ]; then if [ -n "$SCREEN_TERM" -a -n "$HAS_COLOR_TERM" ]; then
BYOBU_TERM="$BYOBU_COLOR_TERM" BYOBU_TERM="$BYOBU_COLOR_TERM"
else
BYOBU_TERM="$BYOBU_DEFAULT_TERM"
fi
fi fi
BYOBU_PROFILE="-f $BYOBU_PREFIX/share/$PKG/profiles/tmuxrc" BYOBU_PROFILE="-f $BYOBU_PREFIX/share/$PKG/profiles/tmuxrc"
# Set default window, unless user has overriden # Set default window, unless user has overriden
@ -174,8 +178,12 @@ case $BYOBU_BACKEND in
# Launch shell, unless the user has default windows set to launch # Launch shell, unless the user has default windows set to launch
uncommented_lines < "$BYOBU_WINDOWS" && DEFAULT_WINDOW= || DEFAULT_WINDOW="${BYOBU_PREFIX}/bin/byobu-shell" uncommented_lines < "$BYOBU_WINDOWS" && DEFAULT_WINDOW= || DEFAULT_WINDOW="${BYOBU_PREFIX}/bin/byobu-shell"
# Use 256 colors if possible # Use 256 colors if possible
if [ -z "$BYOBU_TERM" ]; then
if [ -n "$CAN_SHOW_COLORS" -a -n "$HAS_COLOR_TERM" ]; then if [ -n "$CAN_SHOW_COLORS" -a -n "$HAS_COLOR_TERM" ]; then
BYOBU_TERM="$BYOBU_COLOR_TERM" BYOBU_TERM="$BYOBU_COLOR_TERM"
else
BYOBU_TERM="$BYOBU_DEFAULT_TERM"
fi
fi fi
SCREEN_TERM="-T $BYOBU_TERM" SCREEN_TERM="-T $BYOBU_TERM"
# Some users want to maintain separate configurations # Some users want to maintain separate configurations