What file is responsible for saving window position

mission-controlspaceswindow-manager

Since upgrading to Mojave in 2018, I've had some apps that simply will not remember their window positions properly. They remember the correct Space but not the correct display.

I use dual 27" screens [standard 1440p, not 'retina'], across multiple Spaces, set so both are the same Space [Mission Control prefs]. Left screen is the Primary. Both monitors are permanently connected.
Some apps – all Apple apps, not 3rd party – notably TextEdit, Messages & just recently Apple Remote Desktop has joined this list, after an SSD boot drive change done via Carbon Copy Cloner.

Messages is initially positioned on the right screen, & is set to re-open after Restart. Without fail, it will re-open at the correct height [top of screen] but not on the 2nd display, instead it's tight against the right-hand edge of the left display.

Recently ARD has started displaying similar behaviour. The app itself will open correctly on the right screen, but every other window launched from it will open hard against the right edge of the left screen.

Trashing the Saved Application State has no effect. A search of the drive for 'remotedesktop' brings a bewildering array of files. I've peeked inside a few of the plists but can't see anything like a position reference.

Does anyone have any idea where, generically, window positions are stored? If this is a similar location for many apps, then I can start to dig into which I could trash to try reset this behaviour.
I've reached the point where I'm quite willing to trash an overall Finder prefs list & reset everything from scratch for Spaces/positions if it will help… I just have no clue which one.

I'm not interested in any 3rd party window manager – the OS should be perfectly capable of doing this by itself [& did for many years].

Mac Pro 5,1 Mojave 10.14.6 [correct Metal2 Mac-flashed AMD GPU for Mojave] 64GB RAM, 1TB SSD, half full, 12TB other storage.

Late edit
I 'fixed' Apple Remote Desktop by setting it to 'None' in the Dock right click > Options. I can repeatedly repro the initial issue by toggling to & from 'This Desktop'.
This hasn't worked for Messages, which still stubbornly opens on the left screen.

Additional note I put a high bounty on this with no result. if someone can nail it, I will retrospectively award a 1000* point bounty [as it seems wasteful to just throw it away again]
*ah… Apparently, bounty is capped at 500, so it will have to be that instead.

Best Answer

Assuming the app uses NSWindow, then the position of document windows is usually described in the application's preference file like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>NSWindow Frame TextWindow</key>
    <string>1324 504 544 481 0 0 2560 1417 </string>
</dict>
</plist>

.

For an Apple app, the .plist will be in something like ~/Library/Containers/com.apple.TextEdit/Data/Library/Preferences

A windows.plist file in Containers ... Saved Application State may also hold relevant data.