ZSH: checks for project in prompt

master
Jonathan Hodgson 3 years ago
parent 0fdbfe45b7
commit bda6ca95e4
  1. 6
      shells/zsh/includes/promptconfig.zsh

@ -91,6 +91,7 @@ prompt_dir(){
} }
function prompt_project() { function prompt_project() {
type -p project > /dev/null || return
# Prints the current project and a recording symbol if appropriate # Prints the current project and a recording symbol if appropriate
local parent_process="$(ps -ocommand -p $PPID | grep -v 'COMMAND' | cut -d' ' -f1)" local parent_process="$(ps -ocommand -p $PPID | grep -v 'COMMAND' | cut -d' ' -f1)"
local current_project_full="$(project current --path)" local current_project_full="$(project current --path)"
@ -169,6 +170,7 @@ prompt_last_exit_code() {
prompt_email(){ prompt_email(){
type -p notmuch > /dev/null || return 0 type -p notmuch > /dev/null || return 0
[ -n "$(project current)" ] && return 0
unread="$(notmuch count "tag:unread")" unread="$(notmuch count "tag:unread")"
if [ "$unread" -gt 0 ]; then if [ "$unread" -gt 0 ]; then
echo "🖂 $unread" echo "🖂 $unread"
@ -207,12 +209,16 @@ draw_segment(){
local foreground="" local foreground=""
local ret="" local ret=""
if [ -n "$contents" ]; then if [ -n "$contents" ]; then
if [ -n "$NO_COLOR" ]; then
ret=" $(seperator white black) $contents"
else
background="$(echo "$output" | sed -n '2p')" background="$(echo "$output" | sed -n '2p')"
foreground="$(echo "$output" | sed -n '3p')" foreground="$(echo "$output" | sed -n '3p')"
if [ -n "$previousBackground" ]; then if [ -n "$previousBackground" ]; then
ret=" $(seperator $previousBackground $background)" ret=" $(seperator $previousBackground $background)"
fi fi
ret="$ret$(focusBackgroundColor $background) $(focusForegroundColor $foreground)$contents" ret="$ret$(focusBackgroundColor $background) $(focusForegroundColor $foreground)$contents"
fi
echo "$ret" echo "$ret"
echo "$background" echo "$background"
fi fi

Loading…
Cancel
Save