ZSH: checks for project in prompt
This commit is contained in:
parent
0fdbfe45b7
commit
bda6ca95e4
1 changed files with 11 additions and 5 deletions
|
@ -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
|
||||||
background="$(echo "$output" | sed -n '2p')"
|
if [ -n "$NO_COLOR" ]; then
|
||||||
foreground="$(echo "$output" | sed -n '3p')"
|
ret=" $(seperator white black) $contents"
|
||||||
if [ -n "$previousBackground" ]; then
|
else
|
||||||
ret=" $(seperator $previousBackground $background)"
|
background="$(echo "$output" | sed -n '2p')"
|
||||||
|
foreground="$(echo "$output" | sed -n '3p')"
|
||||||
|
if [ -n "$previousBackground" ]; then
|
||||||
|
ret=" $(seperator $previousBackground $background)"
|
||||||
|
fi
|
||||||
|
ret="$ret$(focusBackgroundColor $background) $(focusForegroundColor $foreground)$contents"
|
||||||
fi
|
fi
|
||||||
ret="$ret$(focusBackgroundColor $background) $(focusForegroundColor $foreground)$contents"
|
|
||||||
echo "$ret"
|
echo "$ret"
|
||||||
echo "$background"
|
echo "$background"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue