diff --git a/.tmux.conf b/.tmux.conf index 8dd606b..8b91963 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -25,7 +25,7 @@ set-option -g display-panes-colour colour166 #orange set-window-option -g clock-mode-colour green #green # disable DISPLAY requirement when opening pane/window -set-option -g update-environment "SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY" +set-option -g update-environment "SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY DISPLAY I3SOCK" set -g status-interval 1 set -g status-justify centre # center align window list diff --git a/.zshrc b/.zshrc index 7b5d9ea..f9bb327 100644 --- a/.zshrc +++ b/.zshrc @@ -118,6 +118,29 @@ function wg-reload() { sudo bash -c 'cd /etc/wireguard && wg syncconf $0 <(wg-quick strip $0)' $1 } +if [ -n "$TMUX" ]; then + function refresh { + sshauth=$(tmux show-environment | grep "^SSH_AUTH_SOCK") + if [ $sshauth ]; then + export $sshauth + fi + display=$(tmux show-environment | grep "^DISPLAY") + if [ $display ]; then + export $display + fi + i3sock=$(tmux show-environment | grep "^I3SOCK") + if [ $i3sock ]; then + export $i3sock + fi + } +else + function refresh { } +fi + +function preexec { + refresh +} + # Finally, start a tmux session [ -x "$(command -v tmux)" ] \ && [ -z "${TMUX}" ] \