summaryrefslogtreecommitdiff
path: root/12_Prompts.zsh
diff options
context:
space:
mode:
Diffstat (limited to '12_Prompts.zsh')
-rw-r--r--12_Prompts.zsh30
1 files changed, 25 insertions, 5 deletions
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