From b0e08593b6740f9a7fafb44bc1ecc23e741a5aac Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Sat, 6 Aug 2016 16:43:09 +0800 Subject: [PATCH] allow the user to override our term choices, by setting BYOBU_TERM, BYOBU_DEFAULT_TERM and/or BYOBU_COLOR_TERM --- debian/changelog | 2 ++ usr/bin/byobu.in | 22 +++++++++++++++------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/debian/changelog b/debian/changelog index aa0a4ac8..ded73f48 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,8 @@ byobu (5.111) unreleased; urgency=medium [ Jeffery To ] * usr/bin/byobu.in, usr/share/byobu/profiles/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 Fri, 29 Jul 2016 12:29:07 -0500 diff --git a/usr/bin/byobu.in b/usr/bin/byobu.in index 9933b4d3..b02e9c94 100755 --- a/usr/bin/byobu.in +++ b/usr/bin/byobu.in @@ -109,11 +109,11 @@ if [ -S "$SSH_AUTH_SOCK" ] && [ ! -h "$SSH_AUTH_SOCK" ]; then export SSH_AUTH_SOCK="$BYOBU_CONFIG_DIR/.ssh-agent" fi -# Terminfo we will use -BYOBU_TERM="screen" +# Fallback terminfo +[ -z "$BYOBU_DEFAULT_TERM" ] && BYOBU_DEFAULT_TERM="screen" # 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 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 [ -z "$SCREEN_TERM" ] && SCREEN_TERM="-2" fi - if [ -n "$SCREEN_TERM" -a -n "$HAS_COLOR_TERM" ]; then - BYOBU_TERM="$BYOBU_COLOR_TERM" + if [ -z "$BYOBU_TERM" ]; then + if [ -n "$SCREEN_TERM" -a -n "$HAS_COLOR_TERM" ]; then + BYOBU_TERM="$BYOBU_COLOR_TERM" + else + BYOBU_TERM="$BYOBU_DEFAULT_TERM" + fi fi BYOBU_PROFILE="-f $BYOBU_PREFIX/share/$PKG/profiles/tmuxrc" # 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 uncommented_lines < "$BYOBU_WINDOWS" && DEFAULT_WINDOW= || DEFAULT_WINDOW="${BYOBU_PREFIX}/bin/byobu-shell" # Use 256 colors if possible - if [ -n "$CAN_SHOW_COLORS" -a -n "$HAS_COLOR_TERM" ]; then - BYOBU_TERM="$BYOBU_COLOR_TERM" + if [ -z "$BYOBU_TERM" ]; then + if [ -n "$CAN_SHOW_COLORS" -a -n "$HAS_COLOR_TERM" ]; then + BYOBU_TERM="$BYOBU_COLOR_TERM" + else + BYOBU_TERM="$BYOBU_DEFAULT_TERM" + fi fi SCREEN_TERM="-T $BYOBU_TERM" # Some users want to maintain separate configurations