One of the things that until recently bugged me about graphics on Linux, at least when it comes to Nvidia graphics, is that I did not know how to generate Xorg.conf file, which is important if you are interested in making changes for dual monitor setups persistent, for example. Today I’m gonna talk about an easy way how to generate Xorg.conf file if you use proprietary Nvidia driver. Why proprietary? Because that’s what I’m using, that’s why, ;).
Surprisingly enough, the method for generating Xorg.conf that I’m gonna be talking about does not require practically any terminal command typing. You also don’t have to stop whatever desktop environment it is that you’re using, which is also something that I read is required. First thing that you need to do is open up the Nvidia X Server Settings and select X Server Display Configuration from the left sidebar.
sudo touch /etc/X11/xorg.conf
I said that there’s no need for a lot of terminal command typing, but you are gonna have to run this command above to create an empty Xorg.conf file inside /etc/X11/. I used the touch command to do that, but there are other ways of how you can go about creating it.
Xorg.conf file that we have just created will be empty, so we have to find out what needs to be added to it. This can’t just be anything because it depends on your graphics card setup. For example I have my TV hooked up to my computer, and I would only like to turn it on (the TV) when I want to. I also need to add an overscan fix in Xorg.conf, because my TV sucks and can’t turn off overscan. I talked about how you can do all this in a previous article.
Now to save all those changes, you just need to click on the Save to X Configuration File button in the bottom right corner of the previously opened X Server Display Configuration section of NVIDIA X Server Settings.
Small pop up window will show up where hopefully you will have the empty Xorg.conf file that we created in the previous step selected. If it’s not, select it by clicking on Browse (it’s in the /etc/X11 directory). I noticed it’s best that for each save you turn off the Merge with existing file option. This will overwrite any old Xorg.conf entries and add everything anew.
By clicking on the Show Preview button, you get to preview generated Xorg.conf settings. If everything’s in order, simply click on the Save button down below, you’ll be asked to type in your root password after which you’ll end with a fully functional Xorg.conf file. Another way how you can quickly create fill out Xorg.conf is by typing in terminal:
sudo gedit /etc/X11/xorg.conf
gedit can be anything you want of course. I use gedit, you might use Kate or vi or nano or whatever. This will both create an empty Xorg.conf file (if it’s not there) or open an existing one and allow you to directly copy/past the generated Xorg.conf configuration from the Show Preview section, which can be seen on the previous image. All in all, this is a very easy way how you can generate Xorg.conf file if you’re running Nvidia proprietary drive. If you have any problems, leave comments down below.