summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugues Hiegel <hugues@hiegel.fr>2009-01-30 15:34:48 +0100
committerHugues Hiegel <hugues@hiegel.fr>2009-01-30 15:34:48 +0100
commit87b805fedb4b677fce27f87155d0be02f1bd62e6 (patch)
tree7bd6cbe87e3089ba6a08546265e76bbccbbcbd08
parentedd56a36739a0d1a4bd7a255c9d184818bcc42ff (diff)
parent9fdd7da7cae3db0e278c0ad1f62a84e72389a9a2 (diff)
Merge commit 'origin/master'
-rw-r--r--.zlogin6
-rwxr-xr-x.zlogout4
-rw-r--r--10_Environment.zsh19
-rw-r--r--12_Prompts.zsh30
4 files changed, 37 insertions, 22 deletions
diff --git a/.zlogin b/.zlogin
index d2eb2ef..753030b 100644
--- a/.zlogin
+++ b/.zlogin
@@ -28,9 +28,9 @@ screen -list
#cmd_exists remind && remind -n
#
-#cmd_exists keychain && keychain --quiet --stop others --inherit any
-#keychain --quiet --quick id_dsa
-#keychain --quiet --quick 593F1F92
+#cmd_exists keychain && eval $(keychain --eval --quiet --quick --inherit any-once --stop others)
+#cmd_exists keychain && keychain --quiet --quick --clear
+#keychain id_dsa 593F1F92
chpwd
true
diff --git a/.zlogout b/.zlogout
new file mode 100755
index 0000000..7e7b00f
--- /dev/null
+++ b/.zlogout
@@ -0,0 +1,4 @@
+#!/bin/zsh
+
+#cmd_exists keychain && keychain --quick --clear
+
diff --git a/10_Environment.zsh b/10_Environment.zsh
index 9e5a1f9..53209ff 100644
--- a/10_Environment.zsh
+++ b/10_Environment.zsh
@@ -21,20 +21,11 @@ export SHELL=`which zsh`
## Agent de clefs SSH/GPG
if [ "$SUDO_USER" = "" ]
then
- if cmd_exists keychain
- then
- if [ -f ~/.keychain/startup.zsh ]
- then
- source ~/.keychain/startup.zsh --quiet
- else
- KEYCHAIN=~/.keychain/$(hostname)-sh
- [ -f ${KEYCHAIN} ] && source ${KEYCHAIN}
- [ -f ${KEYCHAIN}-gpg ] && source ${KEYCHAIN}-gpg
- cmd_exists keychain && keychain --quiet --quick --inherit any --stop others
- [ -f ${KEYCHAIN} ] && source ${KEYCHAIN}
- [ -f ${KEYCHAIN}-gpg ] && source ${KEYCHAIN}-gpg
- fi
- fi
+ KEYCHAIN=~/.keychain/$(hostname)-sh
+ for file in $(find $KEYCHAIN:h -name "$(hostname)-sh" -o -name "$(hostname)-sh-*")
+ do
+ source $file
+ done
fi
## Colors
diff --git a/12_Prompts.zsh b/12_Prompts.zsh
index 11daec7..8a8d5d1 100644
--- a/12_Prompts.zsh
+++ b/12_Prompts.zsh
@@ -39,6 +39,13 @@ preexec ()
local lines="$(expand_text "$PROMPT$1" | sed "s/\\(.\{$COLUMNS\}\\)/\\1\\n/g" | wc -l)"
prompt_colors[date]=$date_colors[exec]
set_prompt_date
+
+ spaceleft=$(($COLUMNS - $AGENTSSIZE - $MAILSTATSIZE - $DATESIZE - $BATTERYSIZE))
+ unset HBAR
+ for h in {1..$spaceleft}
+ do
+ HBAR=$HBAR-
+ done
redisplay_prompt
local string="$(expand_text "$PROMPT$1")"
@@ -94,15 +101,29 @@ update_prompt()
set_prompt_date
# GPG/SSH agents
+
+ KEYCHAIN=~/.keychain/$(hostname)-sh
+ for file in $(find $KEYCHAIN:h -name "$(hostname)-sh" -o -name "$(hostname)-sh-*")
+ do
+ source $file
+ done
+
AGENTS=""
- if [ "$SSH_AGENT_PID" -gt 0 -a "`strings /proc/$SSH_AGENT_PID/cmdline | head -n1`" = "ssh-agent" ]
+ if [ "$SSH_AGENT_PID" -gt 0 -a -e /proc/$SSH_AGENT_PID/cmdline ]
then
- AGENTS=$SEPARATOR$C_$prompt_colors[agents]$_C"★"
+ [ "`strings /proc/$SSH_AGENT_PID/cmdline | head -n1`" = "ssh-agent" ] && \
+ AGENTS=$C_$prompt_colors[agents]$_C"★"
fi
- if [ "$GPG_AGENT_INFO" != "" -a "`strings /proc/$(echo $GPG_AGENT_INFO | cut -d: -f2)/cmdline | head -n1`" = "gpg-agent" ]
+ if [ "$GPG_AGENT_INFO" != "" ]
then
- AGENTS=$AGENTS$SEPARATOR$C_$prompt_colors[agents]$_C"☆"
+ GPG_AGENT_PID="$(echo $GPG_AGENT_INFO | cut -d: -f2)"
+ if [ -e /proc/$GPG_AGENT_PID/cmdline ]
+ then
+ [ "`strings /proc/$GPG_AGENT_PID/cmdline | head -n1`" = "gpg-agent" ] && \
+ AGENTS=$AGENTS$C_$prompt_colors[agents]$_C"☆"
+ fi
fi
+ AGENTS=${AGENTS:+$SEPARATOR$AGENTS}
AGENTSSIZE=$(expand_text $AGENTS)
AGENTSSIZE=$#AGENTSSIZE
@@ -160,7 +181,6 @@ update_prompt()
[ "$DEBUG" = "yes" ] && echo -n " Horizontal bar..."
# First line of prompt, calculation of the remaining place
spaceleft=$(($COLUMNS - $ERRORSIZE - $AGENTSSIZE - $MAILSTATSIZE - $DATESIZE - $BATTERYSIZE))
-
unset HBAR
for h in {1..$spaceleft}
do