From 1a799d22c65d9f4d7497abca0db4f106e86742ed Mon Sep 17 00:00:00 2001 From: Taylor Bockman Date: Thu, 19 Dec 2019 23:55:17 -0800 Subject: [PATCH] Conditional PS1 --- dotfiles/bash/bashrc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/dotfiles/bash/bashrc b/dotfiles/bash/bashrc index a6589b4..917f54a 100644 --- a/dotfiles/bash/bashrc +++ b/dotfiles/bash/bashrc @@ -1,3 +1,5 @@ +#! /usr/bin/env bash + # Use the iterm2 material theme in the root directory of the essentials repository. For linux, # you will need to source a material theme color scheme for your terminal (for XFCE use nord in the xfce # themes folder). @@ -49,5 +51,10 @@ export PROMPT_DIRTRIM=2 # Important note for PS1 modification - everything non-printable must be escaped with `\[` and `\]`. Otherwise readline # fails to track the prompt right and things get messed up when you input long strings. -export PS1=\ -'\[$bold\]\[$white\]\u@\h\[$reset\]: \[$bold\]\[$blue\]\w\[$reset\] \[$green\]\[$(parse_git_branch)\]\[$reset\]\[$bold\]\[$white\]⇨\[$reset\] ' + +if [[ "$OSTYPE" == "linux-gnu" ]]; then + # I had some rendering issues running in XFCE unless I added an extra space at the end. + export PS1='\[$bold\]\[$white\]\u@\h\[$reset\]: \[$bold\]\[$blue\]\w\[$reset\] \[$green\]\[$(parse_git_branch)\]\[$reset\]\[$bold\]\[$white\]⇨\[$reset\] ' +else + export PS1='\[$bold\]\[$white\]\u@\h\[$reset\]: \[$bold\]\[$blue\]\w\[$reset\] \[$green\]\[$(parse_git_branch)\]\[$reset\]\[$bold\]\[$white\]⇨\[$reset\] ' +fi