Skip to content

Instantly share code, notes, and snippets.

@pwang2
Last active May 13, 2020 16:02
Show Gist options
  • Save pwang2/dc969eee8883fd0093c796442f646453 to your computer and use it in GitHub Desktop.
Save pwang2/dc969eee8883fd0093c796442f646453 to your computer and use it in GitHub Desktop.
preexec to sync DISPLAY env
function preexec {
if [ -n "$TMUX" ]; then
export DISPLAY=$(tmux show-environment | grep -oP "(?<=SSH_CLIENT=)[\d\.]*"):0.0
else
export DISPLAY=$(env | grep -oP "(?<=SSH_CLIENT=)[\d\.]*"):0.0
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment