Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Feb 21, 2010, 02:30 PM   #1
Kilamite
macrumors G3
 
Kilamite's Avatar
 
Join Date: Mar 2007
Location: Edinburgh, Scotland
Where Are Window Size and Positions Stored..?

Where about are they stored?
__________________
15" MacBook Pro 2GHz i7 8GB 750GB Hybrid | Mac mini 2.3GHz i7 16GB 1TB Fusion | OS X 10.10
iPhone 5 64GB | Apple TV 3 1080p | iOS 7.1.2
Home Theatre Hackintosh i3 3.5GHz 4GB 3TB | OS X 10.9.2
Kilamite is offline   0 Reply With Quote
Old Feb 21, 2010, 03:23 PM   #2
kainjow
Moderator emeritus
 
kainjow's Avatar
 
Join Date: Jun 2000
NSUserDefaults stores them, so they go in ~/Library/Preferences/com.yourcompany.yourproduct.plist
kainjow is offline   0 Reply With Quote
Old Feb 21, 2010, 03:45 PM   #3
Kilamite
Thread Starter
macrumors G3
 
Kilamite's Avatar
 
Join Date: Mar 2007
Location: Edinburgh, Scotland
Thanks for reply. Checked out the plist file for Safari.

Code:
<key>NSPreferencesContentSize</key>
<string>{508, 240}</string>
I assume that is the window size for Safari (obviously not pixels..)? Can't find anything that would suggest the actual position of the window though.

EDIT:

That aside, if I were have a script to swap the .plist files (say for when I change the resolution), it wouldn't exactly be the best way (but only way..?) since any changes to an application would only apply to one set of plists.
__________________
15" MacBook Pro 2GHz i7 8GB 750GB Hybrid | Mac mini 2.3GHz i7 16GB 1TB Fusion | OS X 10.10
iPhone 5 64GB | Apple TV 3 1080p | iOS 7.1.2
Home Theatre Hackintosh i3 3.5GHz 4GB 3TB | OS X 10.9.2

Last edited by Kilamite; Feb 21, 2010 at 03:55 PM.
Kilamite is offline   0 Reply With Quote
Old Feb 21, 2010, 03:59 PM   #4
chown33
macrumors 603
 
Join Date: Aug 2009
Quote:
Originally Posted by Kilamite View Post
... NSPreferencesContentSize ... Can't find anything that would suggest the actual position of the window though.
Does Safari preserve the actual position of its Preferences window?
chown33 is offline   0 Reply With Quote
Old Feb 21, 2010, 06:38 PM   #5
Kilamite
Thread Starter
macrumors G3
 
Kilamite's Avatar
 
Join Date: Mar 2007
Location: Edinburgh, Scotland
Quote:
Originally Posted by chown33 View Post
Does Safari preserve the actual position of its Preferences window?
Haha.

As long as I know it is in the .plist file that's fine.

Right, so when I change resolutions, a script that swaps the .plist files for that resolution would be cool.. bit annoying it means each resolution's apps will have different preferences.
__________________
15" MacBook Pro 2GHz i7 8GB 750GB Hybrid | Mac mini 2.3GHz i7 16GB 1TB Fusion | OS X 10.10
iPhone 5 64GB | Apple TV 3 1080p | iOS 7.1.2
Home Theatre Hackintosh i3 3.5GHz 4GB 3TB | OS X 10.9.2
Kilamite is offline   0 Reply With Quote
Old Feb 21, 2010, 08:04 PM   #6
chown33
macrumors 603
 
Join Date: Aug 2009
Quote:
Originally Posted by Kilamite View Post
Haha.

As long as I know it is in the .plist file that's fine.

Right, so when I change resolutions, a script that swaps the .plist files for that resolution would be cool.. bit annoying it means each resolution's apps will have different preferences.
What you should do is read Apple's docs on how window positions and sizes are stored in the user-defaults plist. There is a simple way of saving this data, that works for most apps. But most apps aren't obsessed about resolution changes, a point which you've brought up twice now without explaining exactly what you're trying to do, what your app does, or why you care so much about resolution changes.

There are any number of ways to store your specific data in the user-defaults plist. These can be tailored to specific needs, but you have to read the reference docs to see how things work.

Switching plists with a script is bludgeoning the problem into submission with a very blunt weapon. You might get it to work, but it will hardly be a good use of the API.
chown33 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
App window positions not being remembered ebd.i.am OS X Mavericks (10.9) 0 Oct 23, 2013 01:52 AM
App to restore app window positions? pjny Mac Applications and Mac App Store 2 Sep 21, 2013 02:45 AM
Keep a new Finder window the same size? Imola Ghost OS X 10.8 Mountain Lion 0 May 20, 2013 11:24 PM
Finder window size JoeSay Mac Basics and Help 2 May 2, 2013 09:45 PM
Thunderbolt Display window sizes/positions after unplugging splizaat Mac Peripherals 1 Apr 23, 2013 08:04 PM

Forum Jump

All times are GMT -5. The time now is 09:30 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC