Automatically setting the DISPLAY variable

At the moment, I'm using Windows Subsystem for Linux to use Ubuntu, and Xming to allow me to run graphical applications. I was wondering how I could automatically set the display variable to 0, so that I don't need to run "export DISPLAY=:0" every time I open Ubuntu.

1 Answer

Normally you'd add it at the end of .login but that may not be executed in WSL so the safest bet is to add it at the end of .profile.

Edit

Ref: The gist of the startup is .profile is not executed if either .bash_login or .bash_profile exists. To solve this, add this to the end of .bash_profile if it exists.

export DISPLAY=:0.0
echo DISPLAY is $DISPLAY
9

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like