Macos – What controls saved/default window sizes and positions in OS X

display-settingsmacmacos

I am running both Chrome and Chromium on my Mac. I never notice a problem with Chrome but with Chromium it always seems to start off in a very odd and much too small size and position on the screen.

I know there are some good utilities for window management , but what controls the default size / position of windows in OS X?

image

Best Answer

  • It depends on the program. Most of these "main" window settings (or, more precisely, "document" window settings) are sort of hardcoded. I believe they use what Apple provides in their window management frameworks, like for example Preview.app.

    For most apps, only the NSWindow properties of auxiliary windows are stored in the program's Property Lists, while the document window settings may be stored somewhere else. This is what Chrome does, since it is cross-platform and uses a shared preferences format across multiple computers.


    For example, com.macromates.textmate.plist has the following entry:

    NSWindow Frame New File Sheet
    568 932 386 209 0 0 1920 1178
    

    You can change these, and I believe they use rectangle coordinates and origins for representation, the first four values being the NSRect:

    • top left X coordinate
    • top left Y coordinate
    • width
    • height

    TextMate does store its main window position under OakDocumentWindowFrame, but as I already mentioned, this is not the case for all document-based applications.


    Google Chrome uses its own way of dealing with this, namely in a JSON file. It has a window_placement setting, and you can find it in:

    ~/Library/Application Support/Google/Chrome/Default/Preferences

    Here's what it looks like:

    "window_placement": {
             "always_on_top": false,
             "bottom": 1046,
             "left": 0,
             "maximized": false,
             "right": 1680,
             "top": 22,
             "work_area_bottom": 1046,
             "work_area_left": 0,
             "work_area_right": 1680,
             "work_area_top": 22
          },