From ba198b3b44675fa26743e0dde36a7c12368ab179 Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Sat, 3 Aug 2013 14:45:23 -0500 Subject: [PATCH] * usr/bin/byobu-disable-prompt, usr/bin/byobu-enable-prompt, usr/share/byobu/profiles/bashrc, usr/share/byobu/profiles/Makefile.am, usr/share/byobu/profiles/ps1.sh: - use a common bashrc file --- debian/changelog | 6 +++++- usr/bin/byobu-disable-prompt | 1 - usr/bin/byobu-enable-prompt | 24 ++++++--------------- usr/share/byobu/profiles/Makefile.am | 2 +- usr/share/byobu/profiles/bashrc | 31 ++++++++++++++++++++++++++++ usr/share/byobu/profiles/ps1.sh | 1 - 6 files changed, 43 insertions(+), 22 deletions(-) create mode 100644 usr/share/byobu/profiles/bashrc delete mode 100644 usr/share/byobu/profiles/ps1.sh diff --git a/debian/changelog b/debian/changelog index dba8c53d..2566e988 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,10 @@ byobu (5.51) unreleased; urgency=low - * UNRELEASED + * usr/bin/byobu-disable-prompt, usr/bin/byobu-enable-prompt, + usr/share/byobu/profiles/bashrc, + usr/share/byobu/profiles/Makefile.am, + usr/share/byobu/profiles/ps1.sh: + - use a common bashrc file -- Dustin Kirkland Fri, 02 Aug 2013 17:30:11 -0500 diff --git a/usr/bin/byobu-disable-prompt b/usr/bin/byobu-disable-prompt index efd4c387..45f1a276 100755 --- a/usr/bin/byobu-disable-prompt +++ b/usr/bin/byobu-disable-prompt @@ -36,4 +36,3 @@ if [ "$1" != "--no-reload" ]; then fi # vi: syntax=sh ts=4 noexpandtab -# vi: syntax=sh ts=4 noexpandtab diff --git a/usr/bin/byobu-enable-prompt b/usr/bin/byobu-enable-prompt index 8d8e717f..9becfba3 100755 --- a/usr/bin/byobu-enable-prompt +++ b/usr/bin/byobu-enable-prompt @@ -17,30 +17,18 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +[ "$SHELL" = "/bin/bash" ] || exit 1 + PKG="byobu" [ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc" [ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX . "${BYOBU_PREFIX}/lib/${PKG}/include/common" -get_distro -DISTRO="$_RET" -byobu-disable-prompt --no-reload || true -case $DISTRO in - Ubuntu*) - cat >>"$HOME/.bashrc" <>"$HOME/.bashrc" <> "$HOME/.bashrc" + +if [ -n "$TMUX" ]; then tmux send-keys ". ~/.bashrc" \; send-keys Enter else echo diff --git a/usr/share/byobu/profiles/Makefile.am b/usr/share/byobu/profiles/Makefile.am index 31ba0ddf..858ff7a7 100644 --- a/usr/share/byobu/profiles/Makefile.am +++ b/usr/share/byobu/profiles/Makefile.am @@ -1,2 +1,2 @@ profilesdir = $(datadir)/@PACKAGE@/profiles -profiles_DATA = byoburc screenrc common tmux tmuxrc NONE +profiles_DATA = bashrc byoburc screenrc common tmux tmuxrc NONE diff --git a/usr/share/byobu/profiles/bashrc b/usr/share/byobu/profiles/bashrc new file mode 100644 index 00000000..6e7e0d47 --- /dev/null +++ b/usr/share/byobu/profiles/bashrc @@ -0,0 +1,31 @@ +# byobu's bashrc -- colorize the prompt +# Copyright (C) 2013 Dustin Kirkland +# +# Authors: Dustin Kirkland +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, version 3 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Ensure that we're in a tmux or screen session +if [ -n "$TMUX" ] || (printf "$TERMCAP" | grep -qs "screen"); then + # Ensure that we're in bash, in a byobu environment + if [ -n "$BYOBU_BACKEND" ] && [ "$SHELL" = "/bin/bash" ]; then + if grep -qs "^Ubuntu" /etc/issue; then + # Use Ubuntu colors (grey / aubergine / orange) + PS1="${debian_chroot:+($debian_chroot)}\[\e[38;5;245m\]\u\[\e[00m\]@\[\e[38;5;5m\]\h\[\e[00m\]:\[\e[38;5;172m\]\w\[\e[00m\]❭ " + else + # Use Byobu colors (green / blue / red) + PS1="${debian_chroot:+($debian_chroot)}\[\e[00;32m\]\u\[\e[00m\]@\[\e[00;36m\]\h\[\e[00m\]:\[\e[00;31m\]\w\[\e[00m\]\$ " + fi + export TERM="xterm-256color" + fi +fi diff --git a/usr/share/byobu/profiles/ps1.sh b/usr/share/byobu/profiles/ps1.sh deleted file mode 100644 index a0c22bce..00000000 --- a/usr/share/byobu/profiles/ps1.sh +++ /dev/null @@ -1 +0,0 @@ -export PS1="${debian_chroot:+($debian_chroot)}\[\e[00;31m\]\u\[\e[00;30m\]@\[\e[00;36m\]\h\[\e[00m\]:\[\e[00;32m\]\w\[\e[00m\]\$ "