How to make custom refresh rate stay saved?

I'm testing out 14.04 on a partition to see if I want to use it as my main desktop for when it's fully released, but I've encountered some problems.

I have a 144Hz monitor, so in the the Nvidia X Server Settings window I set the refresh rate to 144Hz and it works just fine. However, when I restart my computer those settings revert back to "auto" and I have to reset the refresh rate back to 144Hz each time I log into Ubuntu. How do I make the Nvidia settings stay set to 144Hz?

The refresh rate settings also revert back to auto every time I go into full screen in Minecraft.

I've searched Google and can't seem to find any solution to these problems.

I'm not open to any lectures about how 144Hz is pointless because the eye supposedly can't see a difference beyond a certain refresh rate, so if you intend to lecture me on that incorrect knowledge then please be gone.


Solution 1:

After reading 113 blog posts, SO questions, and other attempts at solving this problem, my refresh rate was still lost on reboot.

From there I combed through man pages and played with dozens of utilities. During that process I discovered the following one-liner works on my 64 bit machine with a GTX 760.

xrandr --output DVI-D-0 --mode 1920x1080 --rate 144

This targets the device connected via DVI-D-0, sets the resolution to 1920W by 1080H, and forces a refresh rate of 144 Hz.

To determine the value for --output, run the following command

xrandr -q

Which will display information like the following.

xrandr -q results

You can see the second to last entry is where I found the device name, as well as supported settings.

I call this script from "Startup Applications" to ensure that it runs immediately following log in. I'm not 100% happy with that solution, because the screens flickers immediately after entering my password. If you can live with that (I can), then this solves the issue.

Solution 2:

To set refresh rate permanently (tested with Ubuntu 16.04):

  • Open ~/.config/monitors.xml.
  • File may have multiple configuration sections which seems to be for different monitor setups there have been. I had most recent setup at most bottom.
  • If you have multiple displays make sure to edit correct output. Write xrandr to terminal and check by name of output that edited output really support wanted mode.
  • Insert refresh rate to rate element.

This method was found from a comment of Kaspar but I think this should be raised as answer.