Last active
May 13, 2020 16:02
-
-
Save pwang2/dc969eee8883fd0093c796442f646453 to your computer and use it in GitHub Desktop.
preexec to sync DISPLAY env
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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