How to make changes in nvidia-settings tool persistent
Looking into the readme indeed helps sometimes :)
This behaviour is intentional to give different users the chance to have their own settings.
In short the nvidia-settings config file is stored in ~/.nvidia-settings-rc
and can be executed by calling nvidia-settings --load-config-only
at startup.
For more details, here's the relevant part of the readme:
4) Loading Settings Automatically
The NVIDIA X driver does not preserve values set with nvidia-settings between runs of the X server (or even between logging in and logging out of X, with xdm, gdm, or kdm). This is intentional, because different users may have different preferences, thus these settings are stored on a per user basis in a configuration file stored in the user‘s home directory.
The configuration file is named "~/.nvidia-settings-rc". You can specify a different configuration file name with the "--config" commandline option.
After you have run nvidia-settings once and have generated a configuration file, you can then run:
nvidia-settings --load-config-only
at any time in the future to upload these settings to the X server again. For example, you might place the above command in your ~/.xinitrc file so that your settings are applied automatically when you log in to X.
Your .xinitrc file, which controls what X applications should be started when you log into X (or startx), might look something like this:
nvidia-settings --load-config-only & xterm & evilwm
or:
nvidia-settings --load-config-only & gnome-session
If you do not already have an ~/.xinitrc file, then chances are that xinit is using a system-wide xinitrc file. This system wide file is typically here:
/etc/X11/xinit/xinitrc
To use it, but also have nvidia-settings upload your settings, you could create an ~/.xinitrc with the contents:
nvidia-settings --load-config-only & . /etc/X11/xinit/xinitrc
System administrators may choose to place the nvidia-settings load command directly in the system xinitrc script.
Please see the xinit(1) manpage for further details of configuring your ~/.xinitrc file.
As an addendum to the previous answer, nvidia-settings only records those attributes related to an X screen in the config file. There are additional settings which can apply to other components; these are not saved.
If you look, all the attributes in the config file are prefixed with {host}:0.0
. Other attributes which can be set are related to GPU and so forth.
For example, I used a HDTV connected to an NVidia card and need to reset the Overscan Compensation (to reduce the displayed screen size to fit the physical screen). This can be adjusted from the GUI, but is not stored in the config file. From the command line, the command is:
nvidia-settings --assign :0[gpu:0]/OverscanCompensation[DFP-1]=80
Note that the attribute name includes a GPU specification.
Fortunately, SyncToVBlank
is in the config file, so just loading it should set it for you. If you execute the command nvidia-settings --query all
it will list all the attributes and the targets to which the apply.