############################ ### Final Prompt Setting ### ############################ if( ${prompt_hcolor} != 0 ) then set last_color = ${reference_colors[${prompt_hcolor}]} endif if( ${prompt_hsym} != 0 ) then set last_sym = ${referencechars[${prompt_hsym}]} endif @ prompt_hcolor = $prompt_hcolor % ${#reference_colors} @ prompt_hsym = $prompt_hsym % ${#referencechars} set critical_battery_level = 10 set low_battery_level = 20 set weak_battery_level = 33 set medium_battery_level = 50 set strong_battery_level = 75 while( ${prompt_hcolor} == 0 ) if( $?CSHENV_DEBUG ) then echo colorshuffle endif #echo  # Shuffle, if supported if( $?CSHENV_DETECTED_SHUF ) then set reference_colors=`shuf -e $reference_colors` else #echo "FALLBACK COLOR!" set reference_colors=`echo $reference_colors | tr " " "\n" | sort -R | xargs` endif if( ! $?last_color ) then break endif set first_color = ${reference_colors[1]} if( ${first_color} != ${last_color} ) then break endif end while( ${prompt_hsym} == 0 ) if( $?CSHENV_DEBUG ) then echo symbolshuffle endif #echo  if( $?CSHENV_DETECTED_SHUF ) then set referencechars=`shuf -e $referencechars` #set reference_colors=`shuf -e $reference_colors` else #echo "FALLBACK CHAR!" set referencechars=`echo $referencechars | tr " " "\n" | sort -R | xargs` endif if( ! $?last_sym ) then break endif set first_sym = ${referencechars[1]} if( ${first_sym} != ${last_sym} ) then break endif end @ prompt_hcolor = ${prompt_hcolor} + 1 @ prompt_hsym = ${prompt_hsym} + 1 if( $?CSHENV_DEBUG ) then echo ${prompt_hcolor} ${prompt_hsym} echo "Setting prompt" endif set prompt_reference_core="%{${reference_colors[${prompt_hcolor}]}%}${referencechars[${prompt_hsym}]}" #if( ${referencechars[${prompt_hsym}]} == `env LC_ALL=C.UTF-8 printf "\u2328"` ) then # set prompt_reference="%{${dim}%}<${prompt_reference_core} %{${dim}%}> " #else # set prompt_reference="%{${dim}%}< ${prompt_reference_core} %{${dim}%}> " #endif set prompt_reference="%{${dim}%}< ${prompt_reference_core} %{${dim}%}> " #set prompt_reference="%{${csi}0;48\;5\;7m%}(${prompt_reference_core}%{${csi}0;48\;5\;7m%})%{${dim}%}" #set prompt_reference="${prompt_reference_core}%{${text_color_seq}%} \- " if( $?CSHENV_SHOW_BATTERY_LEVEL ) then if( $CSHENV_SYSTEM == "Darwin" ) then set battery_level=`pmset -g batt | grep -Eo "\d+%" | cut -d% -f1` else if( $?CSHENV_BATTERY_DEVICE ) then set battery_level=`cat ${CSHENV_BATTERY_DEVICE}` else set battery_level=`cat /sys/class/power_supply/BAT1/capacity` endif if( ${battery_level} < ${critical_battery_level} ) then set battery_color=${red}${blink} else if( ${battery_level} < ${low_battery_level} ) then set battery_color=${red} else if( ${battery_level} < ${weak_battery_level} ) then set battery_color=${yellow} else if( ${battery_level} < ${medium_battery_level} ) then set battery_color=${bright_yellow} else if( ${battery_level} < ${strong_battery_level} ) then set battery_color=${green} else set battery_color=${bright_green} endif if( ${battery_level} < 10 ) then set battery_level=" ${battery_level}" else if( ${battery_level} < 100 ) then set battery_level=" ${battery_level}" endif #set battery_prompt="%{${battery_color}%}%{${battery_level}${at_color}\%%}%{${dim}%} " set battery_prefix="%{${csi}m${csi}28D%}" set battery_prompt="%{${csi}38;2;128;128;255;3mBattery Level:${dim} ${battery_color}${battery_level}${at_color}\%${dim} %}" else set battery_prefix="" set battery_prompt="" endif set git_prompt="" set git_prefix="" set git_repo=`git rev-parse --git-dir >& /dev/null` set __res=$? if( 0 == ${__res} ) then set git_branch=`git branch --show-current -q` >& /dev/null if( ! -z "${git_branch}" ) then set branch_space=30 set branch_indent=16 #set git_branch_reserve=`echo ${git_branch} | wc -c` >& /dev/null #set git_prompt="%{${csi}${branch_indent}C${csi}mBranch: ${csi}3;38;2;255;192;192m${git_branch}${csi}m${csi}${branch_space}C\n%}" # If the font doesn't support the special branch symbol... set branch_symbol=`printf "\uE0A0"` # I could always fallback to this one... (keep padded spaces... for alignment) set branch_symbol=`printf '\u2387\ \ \ '` set git_prompt="%{${csi}0;60m%}(${branch_symbol} %{${csi}3;4;38;2;255;192;192;58;2;255;255;255;68;2;255;255;255m%}${git_branch}%{${csi}m%}) " #set git_prompt="%{${csi}10D${csi}2D(xyz${git_branch})${csi}m%%}" #set git_prompt="%{${csi}0;35m${csi}50D${git_branch} %}" endif else endif #set prompt_cool="%{\n%}${align_prefix}${battery_prefix}${battery_prompt}${date_prompt}${align_suffix}${git_prompt}${brace_color_seq}\[${prompt_reference}${line_prompt}${depth_prompt}${user_prompt}${at_color_seq}@${host_prompt}${text_color_seq}\: ${path_prompt}${brace_color_seq}\]${end_prompt}" set prompt_reference_view="" set line_prompt_view="" set depth_prompt_view="" set user_prompt_view set at_view="" set host_prompt_view="" set git_prompt_view="" set path_prompt_view="" set line_spacer_view="" if( ! $?CSHENV_DISABLE_PROMPT_SIGIL ) then set prompt_reference_view="${prompt_reference}" endif if( ! $?CSHENV_DISABLE_PROMPT_TTY ) then set line_prompt_view="${line_prompt}" set line_spacer_view="${text_color_seq}\- " endif if( ! $?CSHENV_DISABLE_PROMPT_NESTING ) then set depth_prompt_spacing="" if( ! $?CSHENV_DISABLE_PROMPT_TTY ) then set depth_prompt_spacing=" " endif set depth_prompt_view="${depth_prompt_spacing}${depth_prompt}" if( $?CSHENV_HIDE_SHELL_LEVEL_AT_ONE ) then if( ${shlvl} == 1 ) then set depth_prompt_view="" endif endif endif if( ! $?CSHENV_DISABLE_PROMPT_USER ) then set user_prompt_view="${user_prompt}" if( ! $?CSHENV_DISABLE_PROMPT_HOST ) then set at_view="${at_color_seq}@" endif endif if( ! $?CSHENV_DISABLE_PROMPT_HOST ) then set host_prompt_tail=": " if( $?CSHENV_DISABLE_PROMPT_GIT && $?CSHENV_DISABLE_PROMPT_PATH ) then set host_prompt_tail="" endif set host_prompt_view="${host_prompt}${text_color_seq}${host_prompt_tail}" endif if( ! $?CSHENV_DISABLE_PROMPT_GIT ) then set git_prompt_view="${git_prompt}" endif if( ! $?CSHENV_DISABLE_PROMPT_PATH ) then set path_prompt_view="${path_prompt}" endif set prompt_cool="%{\n%}${align_prefix}${battery_prefix}${battery_prompt}${date_prompt}${align_suffix}${brace_color_seq}\[${prompt_reference_view}${line_prompt_view}${depth_prompt_view}${line_spacer_view}${user_prompt_view}${at_view}${host_prompt_view}${git_prompt_view}${path_prompt_view}${brace_color_seq}\]${end_prompt}" if( ! ${?cshenv_user_prompt_override} ) then set prompt="$prompt_cool" endif ########################### # vim:filetype=tcsh ###########################