From 1701c06fcbc1675279a42c16eed23057db83a811 Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Sat, 20 Aug 2011 11:28:56 -0700 Subject: [PATCH] usr/share/byobu/profiles/common, usr/bin/byobu: --- debian/changelog | 2 +- usr/bin/byobu | 10 ++++++++-- usr/lib/byobu/.shutil | 12 ++++++------ 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/debian/changelog b/debian/changelog index 35361b22..0c7b27cc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -77,7 +77,7 @@ byobu (4.30) unreleased; urgency=low * usr/bin/byobu, usr/bin/byobu-janitor, usr/lib/byobu/.shutil: - flatten bold/dim/bright modifiers when in 8-color mode * usr/lib/byobu/ip_address, usr/lib/byobu/.shutil, - usr/share/byobu/profiles/common: + usr/share/byobu/profiles/common, usr/bin/byobu: - fix bold printing -- Dustin Kirkland Thu, 11 Aug 2011 10:31:31 -0500 diff --git a/usr/bin/byobu b/usr/bin/byobu index f8217c9c..832cf773 100755 --- a/usr/bin/byobu +++ b/usr/bin/byobu @@ -42,7 +42,7 @@ fi # Determine backend case "$0" in *byobu-screen) export BYOBU_BACKEND="screen" ;; - *byobu-tmux) export BYOBU_BACKEND="tmux" TERM="screen-256color" ;; + *byobu-tmux) export BYOBU_BACKEND="tmux" ;; esac # Sanitize the environment @@ -58,6 +58,12 @@ fi case $BYOBU_BACKEND in tmux) + # Check if our terminfo supports 256 colors + if command -v tput >/dev/null; then + if [ "$(tput colors 2>/dev/null || echo 0)" = "256" ]; then + export TERM="screen-256color" BYOBU_COLOR=256 + fi + fi PROFILE="-f $BYOBU_PREFIX/share/$PKG/profiles/tmuxrc" ;; *) @@ -79,7 +85,7 @@ case $BYOBU_BACKEND in # Check if our terminfo supports 256 colors if command -v tput >/dev/null; then if [ "$(tput colors 2>/dev/null || echo 0)" = "256" ]; then - export SCREEN_TERM="-T screen-256color" + export SCREEN_TERM="-T screen-256color" BYOBU_COLOR=256 fi fi # Some users want to maintain separate configurations diff --git a/usr/lib/byobu/.shutil b/usr/lib/byobu/.shutil index 06ca3e5d..0ead1128 100755 --- a/usr/lib/byobu/.shutil +++ b/usr/lib/byobu/.shutil @@ -27,8 +27,8 @@ color_screen() { -) printf "$ESC{-}" ;; --) printf "$ESC{-} " ;; esc) printf "$ESC" ;; - bold1) [ -n "$SCREEN_TERM" ] && printf "$ESC{=b }" || printf "$ESC{= }" ;; - bold2) [ -n "$SCREEN_TERM" ] && printf "$ESC{+b }" || printf "$ESC{= }" ;; + bold1) [ -n "$BYOBU_COLOR" ] && printf "$ESC{=b }" || printf "$ESC{= }" ;; + bold2) [ -n "$BYOBU_COLOR" ] && printf "$ESC{+b }" || printf "$ESC{= }" ;; none) printf "$ESC{= }" ;; invert) printf "$ESC{=r }" ;; *) @@ -42,7 +42,7 @@ color_screen() { ;; esac [ "$MONOCHROME" = "1" ] && (fg= ; bg= ) - [ -n "$SCREEN_TERM" ] || attr= + [ -n "$BYOBU_COLOR" ] || attr= printf "$ESC{=$attr $fg$bg}" ;; esac @@ -50,7 +50,7 @@ color_screen() { color_map() { local mod= - [ -n "$SCREEN_TERM" ] && mod=",dim" + [ -n "$BYOBU_COLOR" ] && mod=",dim" case "$1" in k) _RET="black$mod" ;; r) _RET="red$mod" ;; @@ -85,7 +85,7 @@ attr_map() { i) _RET=,italics ;; *) _RET= ;; esac - [ -n "$SCREEN_TERM" ] || _RET= + [ -n "$BYOBU_COLOR" ] || _RET= } color_tmux() { @@ -95,7 +95,7 @@ color_tmux() { -) printf "#[default]" ;; --) printf "#[default] " ;; esc) printf "" ;; - bold*) [ -n "$SCREEN_TERM" ] && printf "#[fg=bold]" ;; + bold*) [ -n "$BYOBU_COLOR" ] && printf "#[fg=bold]" ;; none) printf "#[default]" ;; invert) printf "#[reverse]" ;; *)