Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Funky zsh prompts



Well if it were possible to display a small(very small)bitmap
or xwindows bitmap file of a tachometer with a dial that reflects
the load. This would require of course several bitmaps stored
on the system. Each of the bitmaps would reflect a different
load(state). The higher the needle is on the tachometer the 
higher the load on the system would be. Hope that is clear.

Mike Smith
mikesmit@xxxxxxxxxx

> C. v. Stuckrad (stucki@xxxxxxxxxxxxxxxxx) wrote:
> > On Wed, 25 Mar 1998, Andrew Main wrote:
> > 
> > > >Benbar came up with the amusing idea of making the smiley prompt change
> > > >randomly every time I hit return (or even change to something that
> > > >reflects the load of the machine).
> > > 
> > > Cool idea.
> 
> Very cool!  I think it's about time I posted my BPFH :-)
> 
> Any suggestions for improving it welcome.
> 
> -------- 8< -------- 8< --------
> 
> reset_colour="$(echo -n '\e[0m')"
> bold_colour="$(echo -n '\e[1m')"
> 
> # Foreground
> 
> grey="$(echo -n '\e[30m')"
> red="$(echo -n '\e[31m')"
> green="$(echo -n '\e[32m')"
> yellow="$(echo -n '\e[33m')"
> blue="$(echo -n '\e[34m')"
> magenta="$(echo -n '\e[35m')"
> cyan="$(echo -n '\e[36m')"
> white="$(echo -n '\e[37m')"
> 
> # Background
> 
> bg_grey="$(echo -n '\e[40m')"
> bg_red="$(echo -n '\e[41m')"
> bg_green="$(echo -n '\e[42m')"
> bg_yellow="$(echo -n '\e[43m')"
> bg_blue="$(echo -n '\e[44m')"
> bg_magenta="$(echo -n '\e[45m')"
> bg_cyan="$(echo -n '\e[46m')"
> bg_white="$(echo -n '\e[47m')"
> 
> BASE_PROMPT="%{$bg_blue%}%m:%n%{$reset_colour%} "
> POST_PROMPT="%{$reset_colour%}"
> 
> BASE_PROMPT_NO_COLOUR=$(echo "$BASE_PROMPT" | perl -pe "s/%{.*?%}//g")
> POST_PROMPT_NO_COLOUR=$(echo "$POST_PROMPT" | perl -pe "s/%{.*?%}//g")
> 
> # Define prompts
> 
> PROMPT_NEWLINE=$(echo -ne "\n%{\r%}")
> 
> function precmd {
> 	setopt noxtrace localoptions
> 	local base_prompt base_prompt_etc prompt_length space_left
> 
> 	base_prompt=$(print -P "$BASE_PROMPT_NO_COLOUR")
> 	base_prompt_etc=$(print -P "$base_prompt%(4~|...|)%3.")
> 	prompt_length=${#base_prompt_etc}
> #	echo "Prompt length is $prompt_length"
> #	echo "Base prompt length is $#base_prompt"
> 	if [[ $prompt_length -lt 40 ]]; then
> 		PATH_PROMPT="%{$bold_colour$cyan%}%(4~|...|)%3.%{$white%}"
> 	else
> 		space_left=$(( $COLUMNS - $#base_prompt - 2 ))
> #		echo "Space left is $space_left"
> 		PATH_PROMPT="%{$bold_colour$green%}%${space_left}<...<%~$PROMPT_NEWLINE%{$white%}"
> 	fi
> 	PS1="$BASE_PROMPT$PATH_PROMPT %# $POST_PROMPT"
> 	PS2="$BASE_PROMPT$PATH_PROMPT %_> $POST_PROMPT"
> 	PS3="$BASE_PROMPT$PATH_PROMPT ?# $POST_PROMPT"
> }
> 




Messages sorted by: Reverse Date, Date, Thread, Author