From 0618d5660b36ff1d119d1db6f2ca3336c77ddad9 Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Thu, 10 May 2012 12:32:41 -0700 Subject: [PATCH] * usr/bin/byobu-status: LP: #997766 - handle status wider than terminal more gracefully --- debian/changelog | 3 ++- usr/bin/byobu-status | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 66d0070e..f21eb17e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ byobu (5.18) unreleased; urgency=low - * UNRELEASED + * usr/bin/byobu-status: LP: #997766 + - handle status wider than terminal more gracefully -- Dustin Kirkland Tue, 03 Apr 2012 19:22:04 -0500 diff --git a/usr/bin/byobu-status b/usr/bin/byobu-status index 8f7ae6bc..252a9155 100755 --- a/usr/bin/byobu-status +++ b/usr/bin/byobu-status @@ -35,6 +35,15 @@ for i in "${BYOBU_PREFIX}/share/$PKG/status/status" "${BYOBU_PREFIX}/share/$PKG/ [ -r "$i" ] && . "$i" done +# Fix status printing for small terminal sizes +w=$(tmux list-windows -F "#{session_width}") +read w_last < $BYOBU_RUN_DIR/width || w_last= +if [ "$w" != "$w_last" ]; then + tmux set -g status-left-length $((w*1/4)) >/dev/null 2>&1 + tmux set -g status-right-length $((w*3/4)) >/dev/null 2>&1 + printf "$w" > $BYOBU_RUN_DIR/width +fi + case "$BYOBU_BACKEND" in screen) # Reload profile, if necessary