diff --git a/debian/changelog b/debian/changelog index d96d6322..3ac4f34c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,9 +6,6 @@ byobu (5.75) unreleased; urgency=medium * usr/lib/byobu/include/shutil, usr/lib/byobu/release: LP: #1278016 - /etc/issue might be modified to display corporate banners or 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/lib/byobu/include/constants, usr/lib/byobu/include/Makefile.am, 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 - fix issues with F5 refresh in byobu-screen, when the user has changed 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 ] * usr/lib/byobu/battery: LP: #1289157, #1289157 diff --git a/usr/share/byobu/profiles/bashrc b/usr/share/byobu/profiles/bashrc index 4076620c..43c94d96 100644 --- a/usr/share/byobu/profiles/bashrc +++ b/usr/share/byobu/profiles/bashrc @@ -26,21 +26,29 @@ if [ -n "$TMUX" ] || [ "${TERMCAP#*screen}" != "${TERMCAP}" ]; then # Ensure that we're in bash, in a byobu environment if [ -n "$BYOBU_BACKEND" ] && [ -n "$BASH" ]; then byobu_prompt_status() { local e=$?; [ $e != 0 ] && echo -e "$e "; } - byobu_root() { [ "$USER" = "root" ] && printf "%s" "!"; } - case "$BYOBU_DISTRO" in - "Ubuntu") - # Use Ubuntu colors (grey / aubergine / orange) - [ -n "$BYOBU_CHARMAP" ] || BYOBU_CHARMAP=$(locale charmap 2>/dev/null || echo) + [ -n "$BYOBU_CHARMAP" ] || BYOBU_CHARMAP=$(locale charmap 2>/dev/null || echo) + byobu_prompt_symbol() { + if [ "$USER" = "root" ]; then + printf "%s" "#"; + elif [ "$BYOBU_DISTRO" = "Ubuntu" ]; then case "$BYOBU_CHARMAP" in "UTF-8") # 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 - 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 + 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 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 @@ -52,7 +60,7 @@ if [ -n "$TMUX" ] || [ "${TERMCAP#*screen}" != "${TERMCAP}" ]; then ;; *) # 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 fi