* usr/share/byobu/profiles/bashrc: LP: #1259621

- ensure that if the root user is in byobu, and we're using the
    fancy new colored prompt, that we use a # to indicate root
This commit is contained in:
Dustin Kirkland 2014-03-17 12:49:24 +09:00
commit 20b61e737d
2 changed files with 19 additions and 11 deletions

6
debian/changelog vendored
View file

@ -6,9 +6,6 @@ byobu (5.75) unreleased; urgency=medium
* usr/lib/byobu/include/shutil, usr/lib/byobu/release: LP: #1278016 * usr/lib/byobu/include/shutil, usr/lib/byobu/release: LP: #1278016
- /etc/issue might be modified to display corporate banners or - /etc/issue might be modified to display corporate banners or
legal warnings; try to use /etc/os-release if available legal warnings; try to use /etc/os-release if available
* usr/share/byobu/profiles/bashrc: LP: #1259621
- add a visual queue in the PS1 command prompt when running as the
root user; prepend "!" in front of "root"
* usr/bin/byobu-janitor.in, usr/lib/byobu/include/colors, * usr/bin/byobu-janitor.in, usr/lib/byobu/include/colors,
usr/lib/byobu/include/constants, usr/lib/byobu/include/Makefile.am, usr/lib/byobu/include/constants, usr/lib/byobu/include/Makefile.am,
usr/lib/byobu/include/shutil, usr/share/byobu/profiles/tmux: usr/lib/byobu/include/shutil, usr/share/byobu/profiles/tmux:
@ -31,6 +28,9 @@ byobu (5.75) unreleased; urgency=medium
* usr/bin/byobu-ctrl-a.in: LP: #814172 * usr/bin/byobu-ctrl-a.in: LP: #814172
- fix issues with F5 refresh in byobu-screen, when the user has changed - fix issues with F5 refresh in byobu-screen, when the user has changed
the default escape key the default escape key
* usr/share/byobu/profiles/bashrc: LP: #1259621
- ensure that if the root user is in byobu, and we're using the
fancy new colored prompt, that we use a # to indicate root
[ Kosuke Asami ] [ Kosuke Asami ]
* usr/lib/byobu/battery: LP: #1289157, #1289157 * usr/lib/byobu/battery: LP: #1289157, #1289157

View file

@ -26,21 +26,29 @@ if [ -n "$TMUX" ] || [ "${TERMCAP#*screen}" != "${TERMCAP}" ]; then
# Ensure that we're in bash, in a byobu environment # Ensure that we're in bash, in a byobu environment
if [ -n "$BYOBU_BACKEND" ] && [ -n "$BASH" ]; then if [ -n "$BYOBU_BACKEND" ] && [ -n "$BASH" ]; then
byobu_prompt_status() { local e=$?; [ $e != 0 ] && echo -e "$e "; } byobu_prompt_status() { local e=$?; [ $e != 0 ] && echo -e "$e "; }
byobu_root() { [ "$USER" = "root" ] && printf "%s" "!"; } [ -n "$BYOBU_CHARMAP" ] || BYOBU_CHARMAP=$(locale charmap 2>/dev/null || echo)
case "$BYOBU_DISTRO" in byobu_prompt_symbol() {
"Ubuntu") if [ "$USER" = "root" ]; then
# Use Ubuntu colors (grey / aubergine / orange) printf "%s" "#";
[ -n "$BYOBU_CHARMAP" ] || BYOBU_CHARMAP=$(locale charmap 2>/dev/null || echo) elif [ "$BYOBU_DISTRO" = "Ubuntu" ]; then
case "$BYOBU_CHARMAP" in case "$BYOBU_CHARMAP" in
"UTF-8") "UTF-8")
# MATHEMATICAL RIGHT DOUBLE ANGLE BRACKET (U+27EB, Pe): ⟫ # MATHEMATICAL RIGHT DOUBLE ANGLE BRACKET (U+27EB, Pe): ⟫
PS1="${debian_chroot:+($debian_chroot)}\[\e[38;5;202m\]\$(byobu_prompt_status)\[\e[38;5;245m\]\$(byobu_root)\u\[\e[00m\]@\[\e[38;5;5m\]\h\[\e[00m\]:\[\e[38;5;172m\]\w\[\e[00m\]⟫ " printf "%s" "⟫"
;; ;;
*) *)
# Simple ASCII greater-than sign # Simple ASCII greater-than sign
PS1="${debian_chroot:+($debian_chroot)}\[\e[38;5;202m\]\$(byobu_prompt_status)\[\e[38;5;245m\]\$(byobu_root)\u\[\e[00m\]@\[\e[38;5;5m\]\h\[\e[00m\]:\[\e[38;5;172m\]\w\[\e[00m\]> " printf "%s" ">"
;; ;;
esac esac
else
printf "%s" "\$"
fi
}
case "$BYOBU_DISTRO" in
"Ubuntu")
# Use Ubuntu colors (grey / aubergine / orange)
PS1="${debian_chroot:+($debian_chroot)}\[\e[38;5;202m\]\$(byobu_prompt_status)\[\e[38;5;245m\]\u\[\e[00m\]@\[\e[38;5;5m\]\h\[\e[00m\]:\[\e[38;5;172m\]\w\[\e[00m\]\$(byobu_prompt_symbol) "
export GREP_COLORS="ms=01;38;5;202:mc=01;31:sl=:cx=:fn=01;38;5;132:ln=32:bn=32:se=00;38;5;242" export GREP_COLORS="ms=01;38;5;202:mc=01;31:sl=:cx=:fn=01;38;5;132:ln=32:bn=32:se=00;38;5;242"
export LESS_TERMCAP_mb=$(printf '\e[01;31m') # enter blinking mode red export LESS_TERMCAP_mb=$(printf '\e[01;31m') # enter blinking mode red
export LESS_TERMCAP_md=$(printf '\e[01;38;5;180m') # enter double-bright mode bold light orange export LESS_TERMCAP_md=$(printf '\e[01;38;5;180m') # enter double-bright mode bold light orange
@ -52,7 +60,7 @@ if [ -n "$TMUX" ] || [ "${TERMCAP#*screen}" != "${TERMCAP}" ]; then
;; ;;
*) *)
# Use Byobu colors (green / blue / red) # Use Byobu colors (green / blue / red)
PS1="${debian_chroot:+($debian_chroot)}\[\e[31m\]\$(byobu_prompt_status)\[\e[00;32m\]\u\[\e[00m\]@\[\e[00;36m\]\h\[\e[00m\]:\[\e[00;31m\]\w\[\e[00m\]\$ " PS1="${debian_chroot:+($debian_chroot)}\[\e[31m\]\$(byobu_prompt_status)\[\e[00;32m\]\u\[\e[00m\]@\[\e[00;36m\]\h\[\e[00m\]:\[\e[00;31m\]\w\[\e[00m\]\$(byobu_prompt_symbol) "
;; ;;
esac esac
fi fi