Skip to content

Commit

Permalink
Clean up upper right PS1 and put live marker there as well
Browse files Browse the repository at this point in the history
  • Loading branch information
Niklas Gustavsson committed Apr 24, 2012
1 parent 36998ea commit 5bf6b49
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions .bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -264,18 +264,22 @@ myprompt()
echo "$HOSTPS1$SHORT_PATH$GIT_BRANCH $HAPPY "
}

OS=" "
if [ "$UNAME" = Darwin ]; then
OS=$'\xef\xa3\xbf'
fi
# works around $COLUMN not always being avilable
COLS=$(($(tput cols)-1))
if [ "$INTERACTIVE" = yes ]; then
LIVE="LIVE"
PS1MARKER=" "
if [ "$UNAME" = Darwin ]; then
PS1MARKER=$' \xef\xa3\xbf'
elif $(hostname | egrep "(ash|sto|lon).spotify.net$" | grep -vq "int.sto.spotify.net"); then
PS1MARKER=$LIVE
fi
# works around $COLUMN not always being avilable
COLS=$(($(tput cols)-3))

if $(hostname | egrep "(ash|sto|lon).spotify.net$" | grep -vq "int.sto.spotify.net")
then
PS1='\[\e[1;31m\]$(myprompt)\[\e[0m\]\[\033[s\]\[\033[1;${COLS}f\]$OS\[\033[u\]'
else
PS1='$(myprompt)\[\033[s\]\[\033[1;${COLS}f\]$OS\[\033[u\]'
if [ "$PS1MARKER" = $LIVE ]; then
PS1='$(myprompt)\[\033[s\]\[\033[1;${COLS}f\]\[\e[1;31m\]$PS1MARKER\[\e[0m\]\[\033[u\]'
else
PS1='$(myprompt)\[\033[s\]\[\033[1;${COLS}f\]$PS1MARKER\[\033[u\]'
fi
fi

# sometimes you have to
Expand Down

0 comments on commit 5bf6b49

Please sign in to comment.