feat(tmux): Add shell environment propagation and refresh function
This commit is contained in:
parent
5df3a9898c
commit
5b8c7040be
@ -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
|
||||
|
23
.zshrc
23
.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}" ] \
|
||||
|
Loading…
Reference in New Issue
Block a user