diff --git a/bash/bash_login b/bash/bash_login index b1856637e..77a980ddc 100644 --- a/bash/bash_login +++ b/bash/bash_login @@ -5,22 +5,6 @@ systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT # Load aliases source ${HOME}/.dotfiles/bash/bash_aliases -# Configure static SSH Agent -export SSH_AUTH_SOCK=$HOME/.spool/ssh-agent.sock -if [ -e $SSH_AUTH_SOCK ]; then - rm $SSH_AUTH_SOCK -fi -if [ -e $HOME/.spool/ssh-agent.env ]; then - rm $HOME/.spool/ssh-agent.env -fi -if [[ "`pgrep ssh-agent`" ]]; then - pkill ssh-agent -fi -. $HOME/scripts/ssh-agent.sh - -# Static/predictable Sway socket -export SWAYSOCK=`sway --get-socketpath` - export LANG="C" export LC_ALL="C" export LC_CTYPE="C" diff --git a/bash/bash_login.distrobox b/bash/bash_login.distrobox index e69de29bb..e28ccef48 100644 --- a/bash/bash_login.distrobox +++ b/bash/bash_login.distrobox @@ -0,0 +1 @@ +export SWAYSOCK="${HOME}/.spool/sway-ipc.sock" diff --git a/bash/bash_login.host b/bash/bash_login.host index e69de29bb..0e7d43398 100644 --- a/bash/bash_login.host +++ b/bash/bash_login.host @@ -0,0 +1,15 @@ +# Configure static SSH Agent +export SSH_AUTH_SOCK=$HOME/.spool/ssh-agent.sock +if [ -e $SSH_AUTH_SOCK ]; then + rm $SSH_AUTH_SOCK +fi +if [ -e $HOME/.spool/ssh-agent.env ]; then + rm $HOME/.spool/ssh-agent.env +fi +if [[ "`pgrep ssh-agent`" ]]; then + pkill ssh-agent +fi +. $HOME/scripts/ssh-agent.sh + +# Static/predictable Sway socket +export SWAYSOCK=`sway --get-socketpath` diff --git a/bash/bash_logout b/bash/bash_logout index 6b42c20bf..19ba47d98 100644 --- a/bash/bash_logout +++ b/bash/bash_logout @@ -1,17 +1,5 @@ # vim: ft=sh -if [ ! $SSH_TTY ]; then - # Remove socket files - rm $SSH_AUTH_SOCK - rm $HOME/.spool/ssh-agent.env - rm $SWAYSOCK -fi - -# when leaving the console clear the screen to increase privacy -if [ "$SHLVL" = 1 ]; then - [ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q -fi - if [ -f "/run/.containerenv" ] && grep -oP "(?<=name=\")[^\";]+" /run/.containerenv; then source $HOME/.dotfiles/bash/bash_logout.distrobox else diff --git a/bash/bash_logout.host b/bash/bash_logout.host index e69de29bb..2e8ec787b 100644 --- a/bash/bash_logout.host +++ b/bash/bash_logout.host @@ -0,0 +1,11 @@ +if [ ! $SSH_TTY ]; then + # Remove socket files + rm $SSH_AUTH_SOCK + rm $HOME/.spool/ssh-agent.env + rm $SWAYSOCK +fi + +# when leaving the console clear the screen to increase privacy +if [ "$SHLVL" = 1 ]; then + [ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q +fi diff --git a/bash/bashrc b/bash/bashrc index bb2b9b473..e84c20b24 100644 --- a/bash/bashrc +++ b/bash/bashrc @@ -92,18 +92,6 @@ export TERM="xterm" # Set initial title echo -e -n "\033]2;Welcome to Bash\007" -SSH_AUTH_SOCK="$HOME/.spool/ssh-agent.sock" -if [ -z $SSH_AGENT_PID ]; then - if [ -f "$HOME/.spool/ssh-agent.env" ]; then - source $HOME/.spool/ssh-agent.env >/dev/null - else - if [ ! -f $SSH_AUTH_SOCK ]; then - touch $SSH_AUTH_SOCK - fi - $HOME/scripts/ssh-agent.sh - fi -fi - if [ -f "/run/.containerenv" ] && grep -oP "(?<=name=\")[^\";]+" /run/.containerenv; then source $HOME/.dotfiles/bash/bashrc.distrobox else diff --git a/bash/bashrc.host b/bash/bashrc.host index e69de29bb..51945a405 100644 --- a/bash/bashrc.host +++ b/bash/bashrc.host @@ -0,0 +1,12 @@ +export SSH_AUTH_SOCK="$HOME/.spool/ssh-agent.sock" +if [ -z $SSH_AGENT_PID ]; then + if [ -f "$HOME/.spool/ssh-agent.env" ]; then + source $HOME/.spool/ssh-agent.env >/dev/null + else + if [ ! -f $SSH_AUTH_SOCK ]; then + touch $SSH_AUTH_SOCK + fi + $HOME/scripts/ssh-agent.sh + fi +fi + diff --git a/sway/autostart b/sway/autostart index bfa2e9960..8fc8db1cb 100644 --- a/sway/autostart +++ b/sway/autostart @@ -5,10 +5,6 @@ # Background utilities ################################################################################ -# SSH Add - Should be started by profile instead -# exec eval `ssh-agent -a ${SSH_AUTH_SOCK}` -exec ssh-add & - # Automatically restore last used output configuration # TODO: Need to add fail-safe to script in case the outputs are unavailable exec $HOME/scripts/sway/displays.pl &