From 41d25abd3157b14bfbb89d018d2df38f1adb0ff8 Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Thu, 8 Sep 2011 11:44:38 -0700 Subject: [PATCH] * etc/byobu/backend, usr/bin/byobu, usr/lib/byobu/.common, usr/lib/byobu/.dirs, usr/share/byobu/status/status, usr/share/man/man1/byobu.1: LP: #836090 - fix handling of byobu backend (screen|tmux) handling; thanks to lp:~zorun-42 for the fix --- debian/changelog | 5 +++++ etc/byobu/backend | 2 ++ usr/bin/byobu | 15 +++++++++------ usr/lib/byobu/.common | 13 +++++++++++++ usr/lib/byobu/.dirs | 4 ---- usr/share/byobu/status/status | 2 ++ usr/share/man/man1/byobu.1 | 2 +- 7 files changed, 32 insertions(+), 11 deletions(-) diff --git a/debian/changelog b/debian/changelog index 8e32aa2d..e7cf0533 100644 --- a/debian/changelog +++ b/debian/changelog @@ -14,6 +14,11 @@ byobu (4.33) unreleased; urgency=low * usr/lib/byobu/apport: LP: #842113 - fix broken detection of apport bug reports, thanks to lp:~masterpatricko for the suggested fix + * etc/byobu/backend, usr/bin/byobu, usr/lib/byobu/.common, + usr/lib/byobu/.dirs, usr/share/byobu/status/status, + usr/share/man/man1/byobu.1: LP: #836090 + - fix handling of byobu backend (screen|tmux) handling; thanks to + lp:~zorun-42 for the fix -- Dustin Kirkland Fri, 26 Aug 2011 19:07:32 -0500 diff --git a/etc/byobu/backend b/etc/byobu/backend index 27ee2ae7..34dcce9b 100644 --- a/etc/byobu/backend +++ b/etc/byobu/backend @@ -1,2 +1,4 @@ # BYOBU_BACKEND can currently be "screen" or "tmux" +# Override this on a per-user basis by editing "$BYOBU_CONFIG_DIR/backend" +# or by launching either "byobu-screen" or "byobu-tmux" instead of "byobu". BYOBU_BACKEND="screen" diff --git a/usr/bin/byobu b/usr/bin/byobu index aa5af99b..16e086db 100755 --- a/usr/bin/byobu +++ b/usr/bin/byobu @@ -31,9 +31,18 @@ if [ ! -O "$HOME" ]; then exit 1 fi +# Determine backend as early as possible, if applicable +case "$0" in + *byobu-screen) BYOBU_BACKEND="screen" ;; + *byobu-tmux) BYOBU_BACKEND="tmux" ;; +esac + [ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX . "${BYOBU_PREFIX}/lib/${PKG}/.common" +# At this point, we're sure BYOBU_BACKEND is properly defined +export BYOBU_BACKEND + # Add a version argument for debugging purposes if [ "$#" = "1" ]; then case "$1" in @@ -50,12 +59,6 @@ if [ "$0" = "/etc/profile.d/Z98-$PKG.sh" ] && [ -r "$BYOBU_CONFIG_DIR/disable-au exit 0 fi -# Determine backend -case "$0" in - *byobu-screen) export BYOBU_BACKEND="screen" ;; - *byobu-tmux) export BYOBU_BACKEND="tmux" ;; -esac - # Sanitize the environment byobu-janitor --force diff --git a/usr/lib/byobu/.common b/usr/lib/byobu/.common index d0d3b571..3378e164 100644 --- a/usr/lib/byobu/.common +++ b/usr/lib/byobu/.common @@ -19,7 +19,20 @@ # along with this program. If not, see . if [ -z "${BYOBU_INCLUDED_LIBS}" ]; then + # Needed to set up $BYOBU_CONFIG_DIR . "${BYOBU_PREFIX}/lib/${PKG}/.dirs" + + # If the backend is already set (eg. running `byobu-tmux`), do nothing. + if [ -z "${BYOBU_BACKEND}" ]; then + [ -r "/etc/$PKG/backend" ] && . "/etc/$PKG/backend" + [ -r "$BYOBU_CONFIG_DIR/backend" ] && . "$BYOBU_CONFIG_DIR/backend" + # Just in case there's no config file at all + [ -z "${BYOBU_BACKEND}" ] && BYOBU_BACKEND=screen + fi + + # Creating backend cache + [ -d "$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND" ] || mkdir -p "$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND" + . "${BYOBU_PREFIX}/lib/${PKG}/.shutil" . "${BYOBU_PREFIX}/lib/${PKG}/.constants" BYOBU_INCLUDED_LIBS=1 diff --git a/usr/lib/byobu/.dirs b/usr/lib/byobu/.dirs index af08959a..da9e4d21 100755 --- a/usr/lib/byobu/.dirs +++ b/usr/lib/byobu/.dirs @@ -52,7 +52,3 @@ else # But if not, we'll use a cache directory export BYOBU_RUN_DIR="$HOME/.cache/$PKG" fi - -# Backend cache -[ -n "$BYOBU_BACKEND" ] || BYOBU_BACKEND="screen" -[ -d "$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND" ] || mkdir -p "$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND" diff --git a/usr/share/byobu/status/status b/usr/share/byobu/status/status index 2a55ced4..c66f9d74 100644 --- a/usr/share/byobu/status/status +++ b/usr/share/byobu/status/status @@ -20,6 +20,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +# Status beginning with '#' are disabled. + # Screen has two status lines, with 4 quadrants for status screen_upper_left="color" screen_upper_right="color whoami hostname ip_address menu" diff --git a/usr/share/man/man1/byobu.1 b/usr/share/man/man1/byobu.1 index e3eed74c..1d20ad86 100644 --- a/usr/share/man/man1/byobu.1 +++ b/usr/share/man/man1/byobu.1 @@ -10,7 +10,7 @@ Options to \fBbyobu\fP are simply passed through \fBscreen\fP(1). .SH DESCRIPTION \fBbyobu\fP is a script that launches GNU screen in the byobu configuration. This enables the display of system information and status notifications within two lines at the bottom of the screen session. It also enables multiple tabbed terminal sessions, accessible through simple keystrokes. -Note that BYOBU_CONFIG_DIR=\fI$HOME/.byobu\fP. +Note that BYOBU_CONFIG_DIR=\fI$XDG_CONFIG_HOME/byobu\fP if defined, and \fI$HOME/.byobu\fP otherwise. .SH STATUS NOTIFICATIONS