VGA Monitor Settings

chevy

Marvelous Da Vinci
Staff member
Mod
I would like to force the Graphic card to always start with the 1280 x 1024 at 75 Hz setting. For me and for all users. And I would also like that even when someone (or a piece of software) changes it, it comes back to the original setting at the next start-up.

Any idea where this information is stored ?

If I can lock it ?
 
Thanks, but this is not exactly what I am looking for. I am looking for the file that has the monitor information, so that I can edit it for my monitor. And then lock it.
 
The settings are in /Library/Preferences/com.apple.windowserver.plist

There's more than resolution/depth in there, so I don't know what would happen if you locked the file, and I'm not going to try that on my system... ;)

What you could do, that would be safer, is to take a copy of the file when the display is the way you want it, and copy it into place on startup. It appears that /System/Library/StartUpItems would be the place to do this. If it were me, I'd use one of the existing scripts as a model, and build an item for your task. How are your shell scripting skills? :D

What I don't know is whether the StartUp items are occuring enough before the windowserver gets started to do you much good here.

I'll poke around and see if I can find some better answers for you...
 
Well, after a few hours of hacking on startup scripts, the answer is really very simple. Lock the file. I was a little afraid of doing this, not knowing how the Windowserver would behave if it couldn't write its own plist. Turns out, it will, as long as the file is not locked. Locking the file involves setting the immutable bit while the file is read-only.

Setting the bit for immutable on the file is reasonably simple to do, however it does require some preparation and specific steps to make it work. Let me know if any of this is unclear or needs further detail:

1. Log in as the user that you want to lock the screen resolution down on. If you have multiple users, you'll want to repeat the first couple of steps for each user. If you do not, they'll get locked to whatever their last resolution was before you lock down the preferences.

2. Set the screen resolution/colordepth/refresh rate as desired. Repeat this for each user on the system that you want to prevent changing these settings.

3. Issue the following 2 commands while logged in as an admin user:

sudo chmod 444 /Library/Preferences/com.apple.windowserver.plist
sudo chflags uchg /Library/Preferences/com.apple.windowserver.plist

4. Reboot. This may not, strictly speaking, be required, but it does set PRAM to the current screen resolution. This will prevent screen flashes during boot while the windowserver comes up and resets the display.

5. Enjoy. The users can change resolution for their current session, but as soon as they log out, it will be reset to whatever has been locked in. This also applies to reboots.

To reverse this behaviour, issue the following commands:

sudo chflags nouchg /Library/Preferences/com.apple.windowserver.plist
sudo chmod 644 /Library/Preferences/com.apple.windowserver.plist

Standard disclaimers apply to all of this - I'm not responsible for any damage to the system that you experience by doing any of this. I will, however attempt to help if you get stuck.

Also, if you change the monitor attached to the system, you should unlock the preference file before doing so. Most modern monitors should be able to deal with the resolution and refresh that you mention earlier, but you never can be too sure.

Good luck! Let us know how it works for you.
 
Back
Top