Custom resolution for GTX 1060 on Lubuntu

Jul 21, 2023

I have recently become a permanent resident of the Linux land. I live in Lubuntu town. That's a funny way to say that I use Lubuntu as my daily driver on my laptop. On my laptop, which is an Intel i7 9750H + GTX 1060 combo, it's been kind to me and given me my preferred screen resolution, which was 1600x900 out of the box. That wasn't the case for my desktop, which is an AMD Ryzen 5 1600 + GTX 1060 combo, as it gave me its default resolution of 1920x1080. There's nothing wrong with it, other than the letters appear like tiny dots on screen. When I opened the Monitor Settings, it didn't give me 1600x900, instead there were 1920x0180, 1680x1050, 1600x1200. Nvidia Settings certainly didn't help, it didn't have 1600x900, either. So I had my work cut out for me.

Finding answers in vain

I first tried out this method to set a custom resolution. However, it returned this error and wouldn't allow me to add that resolution:

X Error of failed request: BadMatch (invalid parameter attributes)

Major opcode of failed request: 140 (RANDR)

Minor opcode of failed request: 18 (RRAddOutputMode)

I searched everywhere for a solution to no avail. That means, while there are answers, none satisfies what I'm looking for.. So I tried the next method, setting it on Nvidia's side using Nvidia Settings. According to this post, you want to do this by setting your ViewPortIn to your desired resolution, and your Panning to the desired resolution as well. Do NOT touch ViewPortOut.

I applied it and saved the settings to X File. However it won't write the X File xorg.conf down to /etc/X11/ so I have to issue a command sudo chmod u+x /usr/share/screen-resolution-extra/nvidia-polkit to make it work. After I'd done that, I logged out and back in. Interestingly, the login screen showed that the custom resolution worked, but as soon as I logged in*,* the screen turned back to 1920x1080 and Nvidia reported my screen resolution as Auto.

Stumbled upon the solution

At that point, I was stump. Like what do I do now? I kept trying back and forth between two ways for hours. Nothing works. Until something amazing happened. I read somewhere that after saving the settings on the Nvidia's side, I should change the monitor settings from the OS side, so I switched it to 1680x1050, logged out, logged back in. And voila. It finally clicked. I can't believe it. So I guess that's how it's done.

According to the official guide, the desktop environment, in this case LXQt, may have overridden any configuration from nvidia-settings, hence why Lubuntu switched to 1920x1080 after its login screen was 1600x900. The way I pulled it off seems like a hack, because it is. I'm supposed to either change resolution from the monitor settings within Lubuntu or disable any feature for managing displays. But hey, as long as it works.