summaryrefslogtreecommitdiff
path: root/zsh/rc.d/40-prompt
diff options
context:
space:
mode:
Diffstat (limited to 'zsh/rc.d/40-prompt')
-rw-r--r--zsh/rc.d/40-prompt16
1 files changed, 15 insertions, 1 deletions
diff --git a/zsh/rc.d/40-prompt b/zsh/rc.d/40-prompt
index 66a80e2..d3519ee 100644
--- a/zsh/rc.d/40-prompt
+++ b/zsh/rc.d/40-prompt
@@ -384,6 +384,16 @@ _find_debian () {
_DEBIAN_LABEL="${_DEBIAN_BADGE}${version}"
}
+_KEY_BADGE="🔑"
+
+_check_keys () {
+ if ssh-add -l >/dev/null 2>/dev/null; then
+ _SSH_LABEL="${_KEY_BADGE}"
+ else
+ _SSH_LABEL=""
+ fi
+}
+
# Now hide any functions which won't work due to missing apps.
which bzr >/dev/null 2>&1 || {
@@ -448,6 +458,10 @@ precmd () {
_find_debian && { _LABELS="${_LABELS}${_DEBIAN_LABEL}" }
psvar[6]="$_LABELS"
+
+ _check_keys
+
+ psvar[7]="${_SSH_LABEL}"
}
_VCS_PROMPT="${_VCS_COLOUR}(%1v)${_VCS_RESET}"
@@ -464,7 +478,7 @@ fi
# Prompt as machine% /path/on/right
PS1="%(5V.${_SUDO_ALLOWED}.${_SUDO_RESET})%m${_SUDO_RESET}${_SHELLDEPTH}%(1V.${_VCS_PROMPT}.)%(6V.(%6v).)%# "
-RPS1="%(1V.${_VCS_RPROMPT}.%~)"
+RPS1="%(1V.${_VCS_RPROMPT}.%~)%7v"
if [ "x$debian_chroot" = "x" -a -e /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)