added status for loaded ssh keys

This commit is contained in:
Jonas Forsberg 2021-12-14 08:55:35 +01:00
parent 4b82d2b12e
commit 0df9818314
No known key found for this signature in database
GPG Key ID: F2E9818C70350CC9
2 changed files with 6 additions and 11 deletions

11
.bashrc
View File

@ -5,17 +5,6 @@ export HISTFILESIZE=-1
export EDITOR="vim"
# used by systemd user unit file ssh-agent in ~/.config/systemd/user/ssh-agent.service
#[Unit]
#Description=SSH key agent
#
#[Service]
#Type=simple
#Environment=SSH_AUTH_SOCK=%t/ssh-agent.socket
#ExecStart=/usr/bin/ssh-agent -D -a $SSH_AUTH_SOCK
#
#[Install]
#WantedBy=default.target
#
#Also add "AddKeysToAgent yes" to ~/.ssh/config
export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"

View File

@ -33,6 +33,7 @@ function bash_ps1 () {
local PS1_COLOR_TODO="${PS1_COLOR_TODO:-\[\033[1;30m\]\[\033[43m\]}"
local PS1_COLOR_DOTF="${PS1_COLOR_DOTF:-\[\033[1;37m\]\[\033[45m\]}"
local PS1_COLOR_PASS="${PS1_COLOR_PASS:-\[\033[0;30m\]\[\033[47m\]}"
local PS1_COLOR_SSH="${PS1_COLOR_SSH:-\[\033[0;37m\]\[\033[44m\]}"
local CURRENT_CONTEXT=""
@ -72,6 +73,11 @@ function bash_ps1 () {
fi
fi
if type -t ssh-add > /dev/null;then
if [[ "$(ssh-add -L | grep -E -c '^ssh')" == "0" ]];then
STATUS="${STATUS}${PS1_COLOR_SSH}s"
fi
fi
if [[ $(type -t todo_status) == function ]] && [[ "$(todo_status)" == "YES" ]];then
STATUS="${STATUS}${PS1_COLOR_TODO}T"