From 5721301b25dc44018d85225b93a973e292eebb47 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Wed, 22 Sep 2010 11:52:52 +0200 Subject: [Colors,Prompts] Yeah! console --- 10_Environment.zsh | 7 +++++++ 12_Prompts.zsh | 21 +++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/10_Environment.zsh b/10_Environment.zsh index ee0a20e..733254a 100644 --- a/10_Environment.zsh +++ b/10_Environment.zsh @@ -40,6 +40,7 @@ _C="$_c%}" PS1_ROOT=${PS1_ROOT:-$color[red]} PS1_USER=${PS1_USER:-$color[blue]} +PS1_YEAH="38;5;82" ## Variables d'environnement ``classiques'' # @@ -67,6 +68,12 @@ SAVEHIST=42000 export GPG_TTY=`tty` +# YeahConsole.. +if ( ps fx | grep $$ -B1 | grep -q yeahconsole ) +then + YEAHCONSOLE=true +fi + # Display guess CURRENT_DISPLAY=$(finger 2>&- | tail -n+2 | grep -E $USER'[[:blank:]]+.*[[:blank:]]+tty[0-9][[:blank:]]+($DISPLAY)' | head -n1 | cut -d'(' -f2 | cut -d')' -f1) if [ "$DISPLAY" = "" -a "$CURRENT_DISPLAY" = "" ] diff --git a/12_Prompts.zsh b/12_Prompts.zsh index 0ebc21f..e6b90ab 100644 --- a/12_Prompts.zsh +++ b/12_Prompts.zsh @@ -13,6 +13,10 @@ if privileged_user then prompt_colors[generic]=${PS1_ROOT:-$color[bold];$color[red]} fi +if [ "$YEAHCONSOLE" = "true" ] +then + prompt_colors[generic]=${PS1_YEAH} +fi set_prompt_colors @@ -293,6 +297,23 @@ update_prompt_elements() } redefine_prompt () +{ + case "$YEAHCONSOLE" in + "true") + yeah_prompt + ;; + *) + two_lines_prompt + ;; + esac +} + +yeah_prompt () +{ + PS1=$C_$prompt_color[default]$_C$C_$prompt_colors[user]$_C"%n"$C_$prompt_colors[arob]$_C"@"$C_$prompt_colors[host]$_C"%m "$CURDIR" "$C_$prompt_colors[dies]$_C">"$C_$prompt_colors[cmd]$_C" " +} + +two_lines_prompt () { ## Le prompt le plus magnifique du monde, et c'est le mien ! # Affiche l'user, l'host, le tty et le pwd. Rien que ça... -- cgit v1.2.3