How to make nvidia-settings sticky

Write tutorials for Linux Mint here
More tutorials on https://github.com/orgs/linuxmint/discu ... /tutorials and (archive) on https://community.linuxmint.com/tutorial
Forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post read forum rules
Husse

How to make nvidia-settings sticky

Post by Husse »

This is edited 2007-07-15
This is a problem that has been around some time :)
You change nvidia-settings and after the next boot they are back to default.

Nvidia-settings actually keep your customization but must run for them to take effect.
This guide tells you how to achieve this automatically.
In no part of this guide should you be root - no sudo!
In your ~ folder is a file called .xinitrc
~ is an "alias" for /home/your_name
A dot (.) first in a file name indicates it's a hidden file so you must turn on "Show hidden files" to see it. If it does not exist - create it (text file).
Then add the following

Code: Select all

#!/usr/bin/env bash
/usr/bin/nvidia-settings --load-config-only &
exec gnome-session 
For KDE use

Code: Select all

 exec startkde 
The exec command must be the last command.
Make the file executable

Code: Select all

chmod chmod +x ~/.xinitrc
or use the GUI - right click>Properties>Permissions>Make this file executable
For the xserver to use xinitrc you must create a symlink

Code: Select all

ln -s ~/.xinitrc ~/.xsession
This starts nvidia-settings when you start gnome.

This is all that's needed.
You will have your personal settings for color and more remaining session after session.

This is not about X server Display Configuration but the other settings you find in nvidia-settings
Do not save to xorg.conf from nvidia-settings as all the special settings you may have (Beryl, touchpad etc.) will be removed.
Use the applet for screen resolution in the menu instead

I have read that for some the solution above does not work, and missed the easy solution.
A workaround is to remove --load-config-only
Then nvidia-settings open when gnome starts.
To close nvidia-settings automatically create a hidden file with some name you like in ~. I used ~/.xxx
Add the following to the file:

Code: Select all

#!/usr/bin/env bash
killall /usr/bin/nvidia-settings
Got to the Sessions tab in the menu.
Add a new "Start program" and use the ~/.xxx as target.
nvidia-settings will now close shortly after you see the desktop.
This edit makes Scorp123's remarks below somewhat unnecessary, but they aim at the original posting and are justified.
Last edited by xenopeek on Thu Mar 15, 2012 4:44 am, edited 4 times in total.
Reason: Unstickied
scorp123
Level 8
Level 8
Posts: 2272
Joined: Sat Dec 02, 2006 4:19 pm
Location: Switzerland

Post by scorp123 »

Why so complicated?? :roll: The "man" page is your friend:

Code: Select all

man nvidia-settings
There we can read interesting things like this:

-l, --load-config-only
Load the configuration file, send the values specified therein to the X server, and exit. This mode of operation is useful to place in your .xinitrc file, for example.


I suggest using that parameter above and taking a closer look at man pages before we freak away users with too complicated suggestions? :lol:

BTW, the man page mentions everything. So why do we need to reinvent the wheel when it's already there in the manual?

Code: Select all

3. 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(1), 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(1) 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
...
nelamvr6
Level 4
Level 4
Posts: 327
Joined: Sun Jul 08, 2007 8:14 pm
Location: New London, CT USA

Post by nelamvr6 »

That worked great! Thanks to both of you!
Husse

Post by Husse »

Why so complicated - published prematurely - and I realize now that I must have been really tired when I pushed the submit button....
Somewhere I read that you needed to start nvidia-settings and I did not check out the --load-config-only :( :)
Hopefully we did not freak away users with too complicated suggestions :):)
This has been asked more than once and sadly I did not take time to investigate until now - it's simple.
nelamvr6
Level 4
Level 4
Posts: 327
Joined: Sun Jul 08, 2007 8:14 pm
Location: New London, CT USA

Post by nelamvr6 »

My setting stick now, thanks a lot!
Husse

Post by Husse »

@ D-EJ915 No!
That's not it - that's to get the part of nvidia settings you should not! use sticky. The sloution here does not affect the xorg.conf file :)
vinoman
Level 5
Level 5
Posts: 542
Joined: Wed Sep 05, 2007 8:46 am

Re: How to make nvidia-settings sticky

Post by vinoman »

Husse wrote:This is edited 2007-07-15
This is a problem that has been around some time :)
You change nvidia-settings and after the next boot they are back to default.

Nvidia-settings actually keep your customization but must run for them to take effect.
This guide tells you how to achieve this automatically.
In no part of this guide should you be root - no sudo!
In your ~ folder is a file called .xinitrc
~ is an "alias" for /home/your_name
A dot (.) first in a file name indicates it's a hidden file so you must turn on "Show hidden files" to see it. If it does not exist - create it (text file).
Then add the following

Code: Select all

#!/usr/bin/env bash
/usr/bin/nvidia-settings --load-config-only &
exec gnome-session 
For KDE use

Code: Select all

 exec startkde 
The exec command must be the last command.
Make the file executable

Code: Select all

chmod chmod +x ~/.xinitrc
or use the GUI - right click>Properties>Permissions>Make this file executable
For the xserver to use xinitrc you must create a symlink

Code: Select all

ln -s ~/.xinitrc ~/.xsession
This starts nvidia-settings when you start gnome.

This is all that's needed.
You will have your personal settings for color and more remaining session after session.

This is not about X server Display Configuration but the other settings you find in nvidia-settings
Do not save to xorg.conf from nvidia-settings as all the special settings you may have (Beryl, touchpad etc.) will be removed.
Use the applet for screen resolution in the menu instead

I have read that for some the solution above does not work, and missed the easy solution.
A workaround is to remove --load-config-only
Then nvidia-settings open when gnome starts.
To close nvidia-settings automatically create a hidden file with some name you like in ~. I used ~/.xxx
Add the following to the file:

Code: Select all

#!/usr/bin/env bash
killall /usr/bin/nvidia-settings
Got to the Sessions tab in the menu.
Add a new "Start program" and use the ~/.xxx as target.
nvidia-settings will now close shortly after you see the desktop.
This edit makes Scorp123's remarks below somewhat unnecessary, but they aim at the original posting and are justified.
I don't have an .xinitrc file or folder. This is very confusing. Can you simplify these instructions. I just want to set my resolution to 1440x900. It should be so difficult.
Husse

Post by Husse »

@ vinoman
Use the screen resolution tool for that - the nvidia settings are not aimed at resolution
If you read the beginning of the howto it says if youd don't have .xinitrc create it
vinoman
Level 5
Level 5
Posts: 542
Joined: Wed Sep 05, 2007 8:46 am

Post by vinoman »

The screen resolution tool didn't let me change settings to 1440x900. That's why I did the nvidia-settings. It worked and now my screen is sharp and clear. None of the instructions made much sense to me. Nobody has been able to explain why doing it the way I did it is so bad.

What if I pull out the nvidia card and go with the on-board Intel video? Would it make a difference?

You should be able to set your resolution simply with the resolution tool no matter what video card you have.
Husse

Post by Husse »

You should be able to set your resolution simply with the resolution tool no matter what video card you have.
Agreed - this is a point where work has to be done - and is done
vinoman
Level 5
Level 5
Posts: 542
Joined: Wed Sep 05, 2007 8:46 am

Post by vinoman »

Will it be offered on Celena?
Husse

Post by Husse »

Not in Celena - but perhaps in Daryna (4.0) There will be a lot of work on x in Gutsy and Daryna will be based on gutsy.
But I fear that for the really odd resolutions you may still have to add them in xorg.conf
You should know this is a problem on Windows too (don't know about Mac)
lancest
Level 1
Level 1
Posts: 12
Joined: Sat Mar 03, 2007 8:17 am
Location: Guangzhou, China

Nvidia color settings don't stick

Post by lancest »

Desktop Intel 32. I got the Nvidia custom color settings to start at login but lose them after the power management kicks in.
User avatar
Stretch
Level 2
Level 2
Posts: 76
Joined: Sun Sep 09, 2007 6:19 pm

Post by Stretch »

Husse wrote:
You should be able to set your resolution simply with the resolution tool no matter what video card you have.
Agreed - this is a point where work has to be done - and is done
Have you guys grandr ? It's in the repositories. It puts an applet in the panel and allows you to change resolutions on the fly.
Husse

Post by Husse »

Stretch - which application? Perhaps better than the one we have in the menu
It was not that we were thinking about, but rather that we should not have to go through editing xorg.conf for some settings that wont appear otherwise even with an applet :)
User avatar
Stretch
Level 2
Level 2
Posts: 76
Joined: Sun Sep 09, 2007 6:19 pm

Post by Stretch »

Perhaps I am not understanding correctly :)

I thought you wanted to change resolution to something that was already in xorg.conf. If all your resolutions are in xorg.conf then great... grandr will switch your desktop to one of those resolutions.

However if you are wanting to change to a resolution NOT in xorg.conf, then I don't know of any other way.


grandr is an applet for GNOME panel.
Husse

Post by Husse »

I did not read the post again but if I'm correct the problem where we wanted something better was for e.g. the people with wide screen resolutions (1440x900 and the like) that finds themselves having problems getting this resolution
For me and you it's not all that hard to edit xorg.conf so we get it working - but for noobs coming from Windows....
drifter

Re: How to make nvidia-settings sticky

Post by drifter »

I am a linux newbie. Only had Mint for about a month. Here is the fix that I found to be easiest for myself and it works without any problems.
I noticed that after changing Nvidia settings the program was not able to update the /etc/X11/xorg.conf file.
So what I do is this: I change my settings so that everything is perfect for my setup then I apply settings and select the update xorg.conf button but I dont update. I look at the preveiw that it itends to write to the file. I copy the preveiw and then us nano to completly replace the xorg.conf file with the preveiw (update).
For me this is the easiest and it works great. That is how I configured twinview.
Husse

Re: How to make nvidia-settings sticky

Post by Husse »

create a symlink
That's the same as Right click > Make link :)
I have stopped using nvidia (mostly) but I think it's sufficient to run nvidia-settings as root now, but perhaps this is still needed for gamma etc
Egorama
Level 2
Level 2
Posts: 64
Joined: Tue Aug 04, 2009 7:28 pm
Location: Yorkshire, UK

Re: How to make nvidia-settings sticky

Post by Egorama »

Great post! That's one more niggle nailed.
Dont Believe half of what you see and none of what you here -- Lou Reed
Post Reply

Return to “Tutorials”