diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2019-02-16 21:47:40 +0000 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2019-02-16 21:47:40 +0000 |
commit | 2f23c5d07e087cfeb6066584049a3a34b8adadbb (patch) | |
tree | 47d71fe1a3e97c104bd83772334c73d6247c77bb /zsh/rc.d/40-prompt | |
parent | 8b2defae7f3182d236ac392347455c4c0f2561d2 (diff) | |
download | resources-2f23c5d07e087cfeb6066584049a3a34b8adadbb.tar.bz2 |
Add a key emoji if SSH keys are around
Diffstat (limited to 'zsh/rc.d/40-prompt')
-rw-r--r-- | zsh/rc.d/40-prompt | 16 |
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) |