diff --git a/debian/changelog b/debian/changelog index 74e9252c..73a0a30d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,20 @@ -byobu (5.111) unreleased; urgency=medium +byobu (5.111-0ubuntu1) yakkety; urgency=medium + [ Dustin Kirkland ] * usr/lib/byobu/battery: - battery color when black-on-red is hard to read; change to white on red. + - test 256 colors with vim (:runtime syntax/colortest.vim) and + http://www.robmeerman.co.uk/_media/unix/256colors2.pl + + seem to be working okay here - -- Dustin Kirkland Fri, 29 Jul 2016 12:29:07 -0500 + [ 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 Tue, 09 Aug 2016 15:23:17 -0500 byobu (5.110-0ubuntu1) yakkety; urgency=medium diff --git a/usr/bin/byobu.in b/usr/bin/byobu.in index 7b8d485d..b02e9c94 100755 --- a/usr/bin/byobu.in +++ b/usr/bin/byobu.in @@ -109,12 +109,39 @@ if [ -S "$SSH_AUTH_SOCK" ] && [ ! -h "$SSH_AUTH_SOCK" ]; then export SSH_AUTH_SOCK="$BYOBU_CONFIG_DIR/.ssh-agent" fi +# Fallback terminfo +[ -z "$BYOBU_DEFAULT_TERM" ] && BYOBU_DEFAULT_TERM="screen" + +# Color terminfo to use, if possible +[ -z "$BYOBU_COLOR_TERM" ] && BYOBU_COLOR_TERM="screen-256color" + +# Check if our terminfo supports 256 colors +CAN_SHOW_COLORS= +if $BYOBU_TEST tput >/dev/null 2>&1; then + if [ "$(tput colors 2>/dev/null || echo 0)" = "256" ]; then + CAN_SHOW_COLORS=1 + fi +fi + +# Check if the color terminfo is available +HAS_COLOR_TERM= +if $BYOBU_TEST infocmp >/dev/null 2>&1; then + if infocmp "$BYOBU_COLOR_TERM" >/dev/null 2>&1; then + HAS_COLOR_TERM=1 + fi +fi + case $BYOBU_BACKEND in tmux) # Use 256 colors if possible - if $BYOBU_TEST tput >/dev/null; then - if [ "$(tput colors 2>/dev/null || echo 0)" = "256" ] || [ "$COLORTERM" = "gnome-terminal" ] || [ "$TERM" = "xterm" ] || [ "$TERM" = "xterm-256color" ] || [ "$TERM" = "screen" ]; then - [ -z "$SCREEN_TERM" ] && SCREEN_TERM="-2" + if [ -n "$CAN_SHOW_COLORS" ] || [ "$COLORTERM" = "gnome-terminal" ] || [ "$TERM" = "xterm" ] || [ "$TERM" = "xterm-256color" ] || [ "$TERM" = "screen" ]; then + [ -z "$SCREEN_TERM" ] && SCREEN_TERM="-2" + fi + 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" @@ -150,12 +177,15 @@ case $BYOBU_BACKEND in export BYOBU_WINDOWS # Launch shell, unless the user has default windows set to launch uncommented_lines < "$BYOBU_WINDOWS" && DEFAULT_WINDOW= || DEFAULT_WINDOW="${BYOBU_PREFIX}/bin/byobu-shell" - # Check if our terminfo supports 256 colors - if $BYOBU_TEST tput >/dev/null; then - if [ "$(tput colors 2>/dev/null || echo 0)" = "256" ]; then - SCREEN_TERM="-T screen-256color" + # Use 256 colors if possible + 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 # if they use both GNU Screen and byobu on the same system if [ -r "$BYOBU_CONFIG_DIR/.screenrc" ]; then @@ -176,6 +206,8 @@ case $BYOBU_BACKEND in ;; esac +export BYOBU_TERM + # Save session info [ -n "$DBUS_SESSION_BUS_ADDRESS" ] && printf "DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS\n" > "$BYOBU_RUN_DIR/sockets" [ -n "$SESSION_MANAGER" ] && printf "SESSION_MANAGER=$SESSION_MANAGER\n" >> "$BYOBU_RUN_DIR/sockets" diff --git a/usr/share/byobu/profiles/tmux b/usr/share/byobu/profiles/tmux index c63558b7..2e54bcc9 100644 --- a/usr/share/byobu/profiles/tmux +++ b/usr/share/byobu/profiles/tmux @@ -68,10 +68,7 @@ set-window-option -g automatic-rename on set-window-option -g aggressive-resize on set-window-option -g monitor-activity on -# Cannot use: -# - screen-bce, screen-256color-bce: tmux does not support bce -# - screen-256color: vim broken without -bce -set -g default-terminal "screen" +set -g default-terminal "$BYOBU_TERM" # The following helps with Shift-PageUp/Shift-PageDown set -g terminal-overrides 'xterm*:smcup@:rmcup@'