zsh-users
 help / color / mirror / code / Atom feed
* Re: Zsh question
       [not found] <Pine.GSO.3.96.980325155059.26447D-100000@flivoreuse>
@ 1998-03-25 17:27 ` Andrew Main
  1998-03-26 11:58   ` Zsh question (more smileys in the prompt) C. v. Stuckrad
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Main @ 1998-03-25 17:27 UTC (permalink / raw)
  To: fysh

(Bcced to zsh-users because of possible interest there.  zsh-users
readers, make sure you don't accidentally reply to fysh@fysh.org.)

Giles Constant wrote:
>[pts/2] :)                                              ~/doc [flivoreuse]
>
>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.

PS1='[%l] %1v '
function precmd {
  setopt no_ksh_arrays local_options
  case "${${$(uptime)##*"load average: "}%%,*}" in
    0.[0-4]*) psvar[1]=':-)' ;;
    0.[5-9]*) psvar[1]=':-}' ;;
    1.*)      psvar[1]=':-]' ;;
    2.*)      psvar[1]=':-|' ;;
    3.*)      psvar[1]=':-[' ;;
    [45].*)   psvar[1]=':-{' ;;
    [67].*)   psvar[1]=':-(' ;;
    *)        psvar[1]='|-O' ;;
  esac
}

-zefram


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Zsh question (more smileys in the prompt)
  1998-03-25 17:27 ` Zsh question Andrew Main
@ 1998-03-26 11:58   ` C. v. Stuckrad
  1998-03-26 18:40     ` Andrew Main
  1998-03-26 21:25     ` Funky zsh prompts Adam Spiers
  0 siblings, 2 replies; 6+ messages in thread
From: C. v. Stuckrad @ 1998-03-26 11:58 UTC (permalink / raw)
  To: Andrew Main; +Cc: ZSH User Mailinglist

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.

And OLD idea too :-)  I've already had such a prompt for the last
three years, which includes the output from the original 'smiley'-PROGRAM!

If somebody is really interested, mail me, but I'll have to fish the parts
smiley-parts out of my prompting mechanism from diverse files (It might
need a while :-)

I also have a mechanism to 'sometimes' print system-information 
before my promts, because I supervise more than one system... 

AND I have a problem with LINUX-console color-prompts which 
on being redrawn by (eg.: ^L at the top of the screen)
loose a blank and then edit of by one (no idea where this comes from).

Any ideas how %{...ansi-color-sequences...} might differ in length
between the first time it is done (_typed_) and all the latter times
when it's _redrawn_ to be edited ?


Stucki



Christoph von Stuckrad       * *  | talk to  | <stucki@math.fu-berlin.de> \
Freie Universitaet Berlin    |/_* | nickname | ...!unido!fub!leibniz!stucki|
Fachbereich Mathematik, EDV  |\ * | 'stucki' | Tel:+49 30 838-7545{9|8}    |
Arnimallee 2-6/14195 Berlin  * *  |  on IRC  | Fax:+49 30 838-75454       /


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Zsh question (more smileys in the prompt)
  1998-03-26 11:58   ` Zsh question (more smileys in the prompt) C. v. Stuckrad
@ 1998-03-26 18:40     ` Andrew Main
  1998-03-26 21:25     ` Funky zsh prompts Adam Spiers
  1 sibling, 0 replies; 6+ messages in thread
From: Andrew Main @ 1998-03-26 18:40 UTC (permalink / raw)
  To: stucki; +Cc: zsh-users

C. v. Stuckrad wrote:
>AND I have a problem with LINUX-console color-prompts which 
>on being redrawn by (eg.: ^L at the top of the screen)
>loose a blank and then edit of by one (no idea where this comes from).
>
>Any ideas how %{...ansi-color-sequences...} might differ in length
>between the first time it is done (_typed_) and all the latter times
>when it's _redrawn_ to be edited ?

The only phenomenon I've seen that behaves like that is nothing to
do with escape sequences in the prompt.  In zsh version up to 3.1.2,
if the `correct' length of the prompt changes -- e.g., if you have
the corrent directory in the prompt and then change directory -- then
ZLE can think the prompt has changed length without actually changing
what's on the screen.  Could that be happening here?  (This bug is fixed
in 3.1.2-zefram3.)

If that's not it, could you post your prompt setting please?

-zefram


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Funky zsh prompts
  1998-03-26 11:58   ` Zsh question (more smileys in the prompt) C. v. Stuckrad
  1998-03-26 18:40     ` Andrew Main
@ 1998-03-26 21:25     ` Adam Spiers
  1998-03-26 22:11       ` Mike Smith
  1 sibling, 1 reply; 6+ messages in thread
From: Adam Spiers @ 1998-03-26 21:25 UTC (permalink / raw)
  To: ZSH User Mailinglist

C. v. Stuckrad (stucki@math.fu-berlin.de) 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"
}


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Funky zsh prompts
  1998-03-26 21:25     ` Funky zsh prompts Adam Spiers
@ 1998-03-26 22:11       ` Mike Smith
  1998-03-31 18:27         ` Sven Guckes
  0 siblings, 1 reply; 6+ messages in thread
From: Mike Smith @ 1998-03-26 22:11 UTC (permalink / raw)
  To: ZSH User Mailinglist

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@hpl.hp.com

> C. v. Stuckrad (stucki@math.fu-berlin.de) 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"
> }
> 



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Funky zsh prompts
  1998-03-26 22:11       ` Mike Smith
@ 1998-03-31 18:27         ` Sven Guckes
  0 siblings, 0 replies; 6+ messages in thread
From: Sven Guckes @ 1998-03-31 18:27 UTC (permalink / raw)
  To: ZSH User Mailinglist

Quoting Mike Smith (mikesmit@cousinit.hpl.hp.com):
> 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.

It is clear.  And it is possible.  But it contradicts the purpose of a shell.
Use "xload" instead!

Sven


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1998-03-31 18:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <Pine.GSO.3.96.980325155059.26447D-100000@flivoreuse>
1998-03-25 17:27 ` Zsh question Andrew Main
1998-03-26 11:58   ` Zsh question (more smileys in the prompt) C. v. Stuckrad
1998-03-26 18:40     ` Andrew Main
1998-03-26 21:25     ` Funky zsh prompts Adam Spiers
1998-03-26 22:11       ` Mike Smith
1998-03-31 18:27         ` Sven Guckes

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).