* 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
This commit is contained in:
Dustin Kirkland 2013-08-03 14:45:23 -05:00
commit ba198b3b44
6 changed files with 43 additions and 22 deletions

6
debian/changelog vendored
View file

@ -1,6 +1,10 @@
byobu (5.51) unreleased; urgency=low 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 <kirkland@ubuntu.com> Fri, 02 Aug 2013 17:30:11 -0500 -- Dustin Kirkland <kirkland@ubuntu.com> Fri, 02 Aug 2013 17:30:11 -0500

View file

@ -36,4 +36,3 @@ if [ "$1" != "--no-reload" ]; then
fi fi
# vi: syntax=sh ts=4 noexpandtab # vi: syntax=sh ts=4 noexpandtab
# vi: syntax=sh ts=4 noexpandtab

View file

@ -17,30 +17,18 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
[ "$SHELL" = "/bin/bash" ] || exit 1
PKG="byobu" PKG="byobu"
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc" [ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX [ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
. "${BYOBU_PREFIX}/lib/${PKG}/include/common" . "${BYOBU_PREFIX}/lib/${PKG}/include/common"
get_distro
DISTRO="$_RET"
byobu-disable-prompt --no-reload || true
case $DISTRO in
Ubuntu*)
cat >>"$HOME/.bashrc" <<EOF
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\]❭ " #byobu-prompt#
export TERM="xterm-256color" #byobu-prompt#
EOF
;;
*)
cat >>"$HOME/.bashrc" <<EOF
PS1="${debian_chroot:+($debian_chroot)}\[\e[00;31m\]\u\[\e[00m\]@\[\e[00;36m\]\h\[\e[00m\]:\[\e[00;32m\]\w\[\e[00m\]\$ " #byobu-prompt#
export TERM="xterm-256color" #byobu-prompt#
EOF
;;
esac
if [ -n "$TMUX" ] && [ "$SHELL" = "/bin/bash" ]; then $PKG-disable-prompt --no-reload "$1" || true
printf ". ${BYOBU_PREFIX}/share/${PKG}/profiles/bashrc #byobu-prompt#\n" >> "$HOME/.bashrc"
if [ -n "$TMUX" ]; then
tmux send-keys ". ~/.bashrc" \; send-keys Enter tmux send-keys ". ~/.bashrc" \; send-keys Enter
else else
echo echo

View file

@ -1,2 +1,2 @@
profilesdir = $(datadir)/@PACKAGE@/profiles profilesdir = $(datadir)/@PACKAGE@/profiles
profiles_DATA = byoburc screenrc common tmux tmuxrc NONE profiles_DATA = bashrc byoburc screenrc common tmux tmuxrc NONE

View file

@ -0,0 +1,31 @@
# byobu's bashrc -- colorize the prompt
# Copyright (C) 2013 Dustin Kirkland
#
# Authors: Dustin Kirkland <kirkland@byobu.co>
#
# 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 <http://www.gnu.org/licenses/>.
# 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

View file

@ -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\]\$ "