zsh-users
 help / color / mirror / code / Atom feed
* Eterm and prompt themes
@ 2007-06-14 15:06 Joel J. Adamson
  2007-06-14 15:51 ` Peter Stephenson
  2007-06-14 16:04 ` Bart Schaefer
  0 siblings, 2 replies; 5+ messages in thread
From: Joel J. Adamson @ 2007-06-14 15:06 UTC (permalink / raw)
  To: zsh-users

Hello Z Shellers,

I like using Eterm and I also like using prompt themes.  I recently
noticed that the "fade," "fire," and "elite" prompt themes only
display correctly in Konsole with Central European (ibm852) encoding
set from the "Settings" menu.  The only one that looks worth using is
"adam2."  Pretty cool but I like to change things up every now and then.

Has anyone gotten these to display properly in Eterm or xterm?  Has
anyone found a way to construct something similar that will work in
Eterm?  Please point me in the right direction.

Thanks,
Joel
-- 
Joel J. Adamson
Biostatistician
Pediatric Psychopharmacology Research Unit
Massachusetts General Hospital
Boston, MA  02114
(617) 643-1432
(303) 880-3109





The information transmitted in this electronic communication is intended only for the person or entity to whom it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this information in error, please contact the Compliance HelpLine at 800-856-1983 and properly dispose of this information.


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

* Re: Eterm and prompt themes
  2007-06-14 15:06 Eterm and prompt themes Joel J. Adamson
@ 2007-06-14 15:51 ` Peter Stephenson
  2007-06-14 15:55   ` Peter Stephenson
  2007-06-14 16:04 ` Bart Schaefer
  1 sibling, 1 reply; 5+ messages in thread
From: Peter Stephenson @ 2007-06-14 15:51 UTC (permalink / raw)
  To: zsh-users

On Thu, 14 Jun 2007 11:06:19 -0400
jadamson@partners.org (Joel J. Adamson) wrote:
> I like using Eterm and I also like using prompt themes.  I recently
> noticed that the "fade," "fire," and "elite" prompt themes only
> display correctly in Konsole with Central European (ibm852) encoding
> set from the "Settings" menu.  The only one that looks worth using is
> "adam2."  Pretty cool but I like to change things up every now and
> then.

I just looked and the current code is a bit of a hack even by zsh
standards.  I've made the code work with UTF-8 (I simply ran iconv by hand
to work out the appropriate characters).  This requires your locale to be
set properly, but that's the right way to do it anyway.

In theory we could be more inventive with run-time iconv.  It's unlikely to
work with a randomly chosen 8-bit character set since they focus on useful
characters rather than eye candy, so I'm not that bothered.

I haven't tackled adam1 since although it mentioned funny fonts I
couldn't see any use of them.

Index: Functions/Prompts/.distfiles
===================================================================
RCS file: /cvsroot/zsh/zsh/Functions/Prompts/.distfiles,v
retrieving revision 1.4
diff -u -r1.4 .distfiles
--- Functions/Prompts/.distfiles	7 Feb 2002 07:35:15 -0000	1.4
+++ Functions/Prompts/.distfiles	14 Jun 2007 15:46:23 -0000
@@ -6,4 +6,5 @@
 prompt_bigfade_setup  prompt_off_setup      promptinit
 prompt_elite2_setup   prompt_oliver_setup   prompt_clint_setup
 prompt_walters_setup
+prompt_special_chars
 '
Index: Functions/Prompts/prompt_adam2_setup
===================================================================
RCS file: /cvsroot/zsh/zsh/Functions/Prompts/prompt_adam2_setup,v
retrieving revision 1.4
diff -u -r1.4 prompt_adam2_setup
--- Functions/Prompts/prompt_adam2_setup	19 Aug 2003 21:59:00 -0000	1.4
+++ Functions/Prompts/prompt_adam2_setup	14 Jun 2007 15:46:24 -0000
@@ -10,8 +10,8 @@
 and user input bits respectively.  The default colors are cyan, green,
 cyan, and white.  This theme works best with a dark background.
 
-If you have the `nexus' or `vga' console fonts or similar, you
-can specify the `8bit' option to use 8-bit replacements for the
+If you have either UTF-8 or the `nexus' or `vga' console fonts or similar,
+you can specify the `8bit' option to use 8-bit replacements for the
 7-bit characters.
 
 And you probably thought adam1 was overkill ...
@@ -24,10 +24,17 @@
 
   if [[ $1 == '8bit' ]]; then
     shift
-    prompt_gfx_tlc=$'\xda'
-    prompt_gfx_mlc=$'\xc3'
-    prompt_gfx_blc=$'\xc0'
-    prompt_gfx_hyphen=$'\xc4'
+    if [[ ${LC_ALL:-${LC_CTYPE:-$LANG}} = *UTF-8* ]]; then
+      prompt_gfx_tlc=$'\xe2\x94\x8c'
+      prompt_gfx_mlc=$'\xe2\x94\x9c'
+      prompt_gfx_blc=$'\xe2\x94\x94'
+      prompt_gfx_hyphen=$'\xe2\x94\x80'
+    else
+      prompt_gfx_tlc=$'\xda'
+      prompt_gfx_mlc=$'\xc3'
+      prompt_gfx_blc=$'\xc0'
+      prompt_gfx_hyphen=$'\xc4'
+    fi
   else
     prompt_gfx_tlc='.'
     prompt_gfx_mlc='|'
Index: Functions/Prompts/prompt_bigfade_setup
===================================================================
RCS file: /cvsroot/zsh/zsh/Functions/Prompts/prompt_bigfade_setup,v
retrieving revision 1.2
diff -u -r1.2 prompt_bigfade_setup
--- Functions/Prompts/prompt_bigfade_setup	10 May 2005 04:39:02 -0000	1.2
+++ Functions/Prompts/prompt_bigfade_setup	14 Jun 2007 15:46:24 -0000
@@ -14,8 +14,10 @@
 colors are blue, white, white, and yellow.  This theme works best with
 a dark background.
 
-Recommended fonts for this theme: nexus or vga or similar.  If you
-don't have any of these, the 8-bit characters will probably look stupid.
+
+Recommended fonts for this theme: either UTF-8, or nexus or vga or similar.
+If you don't have any of these, the 8-bit characters will probably look
+stupid.
 EOH
 }
 
@@ -25,9 +27,9 @@
   local date=${3:-'white'}
   local cwd=${4:-'yellow'}
 
-  for code in 333 262 261 260; do
-    local char_$code=$(echo -n "\\0$code")
-  done
+  local char_333 char_262 char_261 char_260
+  autoload -U prompt_special_chars
+  prompt_special_chars
 
   PS1="%{$bold_color$fg[$fadebar]$bold_color%}$char_333$char_262$char_261$char_260%{$bold_color$fg[$userhost]$bg[$fadebar]%}%n@%m%{$reset_color$fg[$fadebar]$bg[grey]%}$char_260$char_261$char_262$char_333%{$reset_color$fg[$fadebar]$bg[grey]%}$char_333$char_262$char_261$char_260%{$bold_color$fg[$date]$bg[grey]%} %D{%a %b %d} %D{%I:%M:%S%P}$prompt_newline%{$bold_color$fg[$cwd]$bg[grey]%}$PWD>%{$reset_color%} "
   PS2="%{$bold_color$fg[$fadebar]$bold_color%}$char_333$char_262$char_261$char_260%{$reset_color$fg[$fadebar]$bg[grey]%}$char_260$char_261$char_262$char_333%{$reset_color$fg[$fadebar]$bg[grey]%}$char_333$char_262$char_261$char_260%{$bold_color$bold_color$fg[$fadebar]%}>%{$reset_color%} "
Index: Functions/Prompts/prompt_elite2_setup
===================================================================
RCS file: /cvsroot/zsh/zsh/Functions/Prompts/prompt_elite2_setup,v
retrieving revision 1.3
diff -u -r1.3 prompt_elite2_setup
--- Functions/Prompts/prompt_elite2_setup	10 May 2005 04:39:02 -0000	1.3
+++ Functions/Prompts/prompt_elite2_setup	14 Jun 2007 15:46:24 -0000
@@ -11,8 +11,9 @@
 The default colors are both cyan.  This theme works best with a dark
 background.
 
-Recommended fonts for this theme: nexus or vga or similar.  If you
-don't have any of these, the 8-bit characters will probably look stupid.
+Recommended fonts for this theme: either UTF-8, or nexus or vga or similar.
+If you don't have any of these, the 8-bit characters will probably look
+stupid.
 EOH
 }
 
@@ -20,9 +21,9 @@
   local text_col=${1:-'cyan'}
   local parens_col=${2:-$text_col}
 
-  for code in 332 304 300; do
-    local char_$code=$(echo -n "\\0$code")
-  done
+  local char_333 char_262 char_261 char_260
+  autoload -U prompt_special_chars
+  prompt_special_chars
 
   local text="%{$fg_no_bold[$text_col]%}"
   local parens="%{$fg_bold[$parens_col]%}"
Index: Functions/Prompts/prompt_elite_setup
===================================================================
RCS file: /cvsroot/zsh/zsh/Functions/Prompts/prompt_elite_setup,v
retrieving revision 1.2
diff -u -r1.2 prompt_elite_setup
--- Functions/Prompts/prompt_elite_setup	10 May 2005 04:39:02 -0000	1.2
+++ Functions/Prompts/prompt_elite_setup	14 Jun 2007 15:46:24 -0000
@@ -11,8 +11,9 @@
 The default colors are red and blue respectively.  This theme is
 intended for use with a black background.
 
-Recommended fonts for this theme: nexus or vga or similar.  If you
-don't have any of these, the 8-bit characters will probably look stupid.
+Recommended fonts for this theme: either UTF-8, or nexus or vga or similar.
+If you don't have any of these, the 8-bit characters will probably look
+stupid.
 EOH
 }
 
@@ -20,9 +21,9 @@
   local text=${1:-'red'}
   local punctuation=${2:-'blue'}
 
-  for code in 332 304 371 372 300; do
-    local char_$code=$(echo -n "\\0$code")
-  done
+  local char_333 char_262 char_261 char_260
+  autoload -U prompt_special_chars
+  prompt_special_chars
 
   PS1="%{$fg[$text]%}$char_332$char_304%{$fg[$punctuation]%}(%{$fg[$text]%}%n%{$fg[$punctuation]%}@%{$fg[$text]%}%m%{$fg[$punctuation]%})%{$fg[$text]%}-%{$fg[$punctuation]%}(%{$fg[$text]%}%D{%I:%M%P}%{$fg[$punctuation]%}-:-%{$fg[$text]%}%D{%m}%{$fg[$punctuation]$fg[$text]%}/%D{%d}%{$fg[$punctuation]%})%{$fg[$text]%}$char_304-%{$fg[$punctuation]]%}$char_371%{$fg[$text]%}-$char_371$char_371%{$fg[$punctuation]%}$char_372$prompt_newline%{$fg[$text]%}$char_300$char_304%{$fg[$punctuation]%}(%{$fg[$text]%}%1~%{$fg[$punctuation]%})%{$fg[$text]%}$char_304$char_371%{$fg[$punctuation]%}$char_372%{$reset_color%}"
   PS2="> "
Index: Functions/Prompts/prompt_fade_setup
===================================================================
RCS file: /cvsroot/zsh/zsh/Functions/Prompts/prompt_fade_setup,v
retrieving revision 1.2
diff -u -r1.2 prompt_fade_setup
--- Functions/Prompts/prompt_fade_setup	10 May 2005 04:39:02 -0000	1.2
+++ Functions/Prompts/prompt_fade_setup	14 Jun 2007 15:46:24 -0000
@@ -14,8 +14,8 @@
 default colors are green, white, and white.  This theme works best
 with a dark background.
 
-Recommended fonts for this theme: nexus or vga or similar.  If you
-don't have any of these, the 8-bit characters will probably look
+Recommended fonts for this theme: either UTF-8, or nexus or vga or similar.
+If you don't have any of these, the 8-bit characters will probably look
 stupid.
 EOH
 }
@@ -27,9 +27,9 @@
   local userhost=${2:-'white'}
   local date=${3:-'white'}
 
-  for code in 333 262 261 260; do
-    local char_$code=$(echo -n "\\0$code")
-  done
+  local char_333 char_262 char_261 char_260
+  autoload -U prompt_special_chars
+  prompt_special_chars
 
   PS1="%{$fg[$fadebar_cwd]$bg[$fadebar_cwd]$bold_color%}$char_333$char_262$char_261$char_260%{$fg[$userhost]$bg[$fadebar_cwd]$bold_color%}%n@%m%{$reset_color$fg[$fadebar_cwd]$bg[grey]%}$char_333$char_262$char_261$char_260%{$fg[$date]$bg[grey]$bold_color%} %D{%a %b %d} %D{%I:%M:%S%P} $prompt_newline%{$fg[$fadebar_cwd]$bg[grey]$bold_color%}%~/%{$reset_color%} "
   PS2="%{$fg[$fadebar_cwd]$bg[grey]%}$char_333$char_262$char_261$char_260%{$reset_color%}>"
Index: Functions/Prompts/prompt_fire_setup
===================================================================
RCS file: /cvsroot/zsh/zsh/Functions/Prompts/prompt_fire_setup,v
retrieving revision 1.2
diff -u -r1.2 prompt_fire_setup
--- Functions/Prompts/prompt_fire_setup	10 May 2005 04:39:02 -0000	1.2
+++ Functions/Prompts/prompt_fire_setup	14 Jun 2007 15:46:24 -0000
@@ -15,8 +15,9 @@
 The default colors are yellow, yellow, red, white, white, and yellow.
 This theme works best with a dark background.
 
-Recommended fonts for this theme: nexus or vga or similar.  If you
-don't have any of these, the 8-bit characters will probably look stupid.
+Recommended fonts for this theme: either UTF-8, or nexus or vga or similar.
+If you don't have any of these, the 8-bit characters will probably look
+stupid.
 EOH
 }
 
@@ -28,9 +29,9 @@
   local date=${5:-'white'}
   local cwd=${6:-'yellow'}
 
-  for code in 333 262 261 260; do
-    local char_$code=$(echo -n "\\0$code")
-  done
+  local char_333 char_262 char_261 char_260
+  autoload -U prompt_special_chars
+  prompt_special_chars
 
   local GRAD1="%{$char_333$char_262$char_261$char_260%}"
   local GRAD2="%{$char_260$char_261$char_262$char_333%}"
Index: Functions/Prompts/prompt_special_chars
===================================================================
RCS file: Functions/Prompts/prompt_special_chars
diff -N Functions/Prompts/prompt_special_chars
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Functions/Prompts/prompt_special_chars	14 Jun 2007 15:46:24 -0000
@@ -0,0 +1,18 @@
+# Utility function to set up some special characters
+# used by prompts.
+#
+# These used to be defined to characters found in particular
+# character sets (e.g. IBM852) which now aren't widely used.
+# We still provide them in that form if the current character
+# set isn't UTF-8.  We could in principle use iconv if available.
+
+if [[ ${LC_ALL:-${LC_CTYPE:-$LANG}} = *UTF-8* ]]; then
+  char_333=$'\xe2\x96\x88'
+  char_262=$'\xe2\x96\x93'
+  char_261=$'\xe2\x96\x92'
+  char_260=$'\xe2\x96\x91'
+else
+  for code in 333 262 261 260; do
+    char_$code=$(echo -n "\\0$code")
+  done
+fi


-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php

To get further information regarding CSR, please visit our Investor Relations page at http://ir.csr.com/csr/about/overview


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

* Re: Eterm and prompt themes
  2007-06-14 15:51 ` Peter Stephenson
@ 2007-06-14 15:55   ` Peter Stephenson
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Stephenson @ 2007-06-14 15:55 UTC (permalink / raw)
  To: zsh-users

Peter Stephenson wrote:
> I just looked and the current code is a bit of a hack even by zsh
> standards.  I've made the code work with UTF-8 (I simply ran iconv by hand
> to work out the appropriate characters).  This requires your locale to be
> set properly, but that's the right way to do it anyway.

I should have pointed out this needs zsh 4.3 otherwise it won't
count the widths of the multibyte characters properly.

pws


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php

To get further information regarding CSR, please visit our Investor Relations page at http://ir.csr.com/csr/about/overview


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

* Re: Eterm and prompt themes
  2007-06-14 15:06 Eterm and prompt themes Joel J. Adamson
  2007-06-14 15:51 ` Peter Stephenson
@ 2007-06-14 16:04 ` Bart Schaefer
  2007-06-14 16:36   ` Joel J. Adamson
  1 sibling, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2007-06-14 16:04 UTC (permalink / raw)
  To: zsh-users

On Jun 14, 11:06am, Joel J. Adamson wrote:
}
} I like using Eterm and I also like using prompt themes.  I recently
} noticed that the "fade," "fire," and "elite" prompt themes only
} display correctly in Konsole with Central European (ibm852) encoding
} set from the "Settings" menu.

Those themes require a character set that contains dithered half-color
"block" characters (that display like spaces).  They were designed (I
think) by people who ran linux in text mode on a PC console, and long
before zsh had much if any support for non-ASCII-based character sets.

Several of the other themes require character sets that contain line-
drawing characters.  All of these assume text is in ASCII 1-127 with
the half-color or line-draw characters in the 128-255 value range.

} The only one that looks worth using is "adam2." Pretty cool but I like
} to change things up every now and then.

It shouldn't be that difficult to design your own theme.

} Has anyone gotten these to display properly in Eterm or xterm?

Google for X font packages that mimic old IBM-PC fonts (these would
be pretty ancient now -- I believe one of them was named "9x13" and
"prompt -h fire" suggests "nexus" or "vga" are others) if you really
want to see these working.

-- 


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

* Re: Eterm and prompt themes
  2007-06-14 16:04 ` Bart Schaefer
@ 2007-06-14 16:36   ` Joel J. Adamson
  0 siblings, 0 replies; 5+ messages in thread
From: Joel J. Adamson @ 2007-06-14 16:36 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-users

Bart Schaefer <schaefer@brasslantern.com> writes:

> On Jun 14, 11:06am, Joel J. Adamson wrote:

> } The only one that looks worth using is "adam2." Pretty cool but I like
> } to change things up every now and then.
>
> It shouldn't be that difficult to design your own theme.

Exactly what I think, however there's so much about the Z shell that
is so cool, I'm a bit overwhelmed at the moment ;)

I've found some good webpages on the topic, so I will figure it out
eventually.

Thanks,
Joel

-- 
Joel J. Adamson
Biostatistician
Pediatric Psychopharmacology Research Unit
Massachusetts General Hospital
Boston, MA  02114
(617) 643-1432
(303) 880-3109





The information transmitted in this electronic communication is intended only for the person or entity to whom it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this information in error, please contact the Compliance HelpLine at 800-856-1983 and properly dispose of this information.


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

end of thread, other threads:[~2007-06-14 16:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-14 15:06 Eterm and prompt themes Joel J. Adamson
2007-06-14 15:51 ` Peter Stephenson
2007-06-14 15:55   ` Peter Stephenson
2007-06-14 16:04 ` Bart Schaefer
2007-06-14 16:36   ` Joel J. Adamson

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).