Where I Left It
Remembers each app's window position and size, restores it when the app opens again, and keeps open windows reachable when your display setup changes
Author: metanoid18
Remembers where you left each app's window -- its position, its size, and which
monitor it was on -- and puts it back when the app opens again. It also keeps
windows that are already open reachable when your display setup changes: a
monitor going away, a different resolution, docking or undocking, or a
rotation.
Getting started
The mod does nothing until you tell it which apps to manage. Open the mod's
settings, add an executable name (for example notepad.exe) or a full path to
Apps to manage, and save. Only windows belonging to the executables in that
list are remembered or moved.
How it behaves
- Geometry is captured when you move or resize a window, and when a window
closes. Move a window where you want it, close it, and it opens there next
time -- in the same session or after a reboot.
- Maximized and minimized windows are handled as you would expect: a window that
was maximized comes back maximized, and one that was minimized comes back where
it was, at its normal size, or maximized if it was maximized before it was
minimized.
- Saving is per monitor arrangement. A window is restored to the same monitor it
was on, and after docking or undocking it is mapped to the closest equivalent
monitor instead of being left off-screen.
- Windows that are already open are moved too. When the display arrangement
changes -- a different resolution, docking, a monitor waking up or going away
-- open tracked windows are mapped from the monitor they were on to the closest
equivalent monitor that still exists, keeping the same fraction of that
monitor. Nothing is left stranded on a monitor that is no longer there.
- Moving or resizing a window always wins over anything the mod was doing. If an
application insists on its own placement, the mod tries once more and then
stops fighting it.
- Each app's saved geometry can remember its position and its size separately,
per app, in the settings. With Restore size off, a window is placed but not
resized, so an app that sizes itself to its content keeps that size; with
Restore position off, it is sized where it opened. Both are still recorded
while off, so switching a box back on brings back the last position or size
that window had rather than a value frozen at the moment it was switched off.
Out of scope in v1
- Moving windows between virtual desktops
- Z-order (stacking order) restore
- Re-scaling what is inside a window when the scale percentage changes. The
frame is moved and sized; how an app redraws its contents is up to the app.
- A periodic check for monitor changes. The mod reacts to Windows' display-change
notification and is silent the rest of the time.
- UWP / Store apps that restore their own window placement
Known limitations
- Elevated windows are not moved. Windows cannot be repositioned across
integrity levels: the move is refused with access denied, the mod detects the
refusal, leaves that window alone for the rest of the session, and records why.
The window is still tracked, so it is not ignored -- the mod tries. While a
refusal stands, that window's position is not saved either: your chosen
position for it is not overwritten by wherever it happened to be sitting.
- Titles are part of how a window is matched. A window whose title changed
between sessions falls back to matching by executable, class and ordinal, and
is only restored when that match is unambiguous. Windows with identical titles
may be restored to each other's positions.
- A save at close can lose its turn. The rectangle is read from the window as
the window is closing, and Windows sometimes has the window out of the way first.
When that happens nothing is recorded for that close, the diagnostics journal says
so with a reason, and the window keeps whatever position it was last remembered
at. Moving the window once by hand records it there and then, and that save is not
a last-moment read, so this is about windows that are moved by something other than
you and closed immediately after.
- A window that was minimized when it closed comes back where it was, at its
normal size, or maximized if it was maximized before it was minimized. It does
not come back minimized.
- Stored resolution is not rescaled when DPI changes. Nothing multiplies a
stored rectangle by a DPI ratio. After a display change a window is mapped by
the rules above, which already express it as a fraction of its monitor -- so a
change of scale percentage on its own leaves windows where they are, because no
monitor has moved.
- A window is measured against the screen, not against the taskbar. The
taskbar is taller in pixels at a larger scale, so a window restored after a
change of scale percentage can sit partly behind it. Move the window once and
the new position is what is remembered.
- A maximized window is left where Windows puts it. While its monitor still
exists, its maximized state and placement stay Windows' own business -- the mod
does not move it, and it is not resized by a resolution change. If the monitor
it was maximized on disappears, it is rescued onto a remaining monitor like any
other window.
- UWP and Store apps often restore their own placement and may ignore the
mod.
- If an application moves its window right after showing, the mod re-applies the
stored geometry once. Applications that keep overriding it are left alone.
Diagnostics
Turn on Write a diagnostics journal in the settings and the mod appends a
line to window-geometry-journal.txt for every save, restore and decision, with
the exact rectangle and monitor involved. It is the fastest way to see why a
particular window was or was not restored, and it is worth attaching to a bug
report. It is off by default.
Both files live in a folder named after the signed-in user's SID, inside the mod's
storage folder. That storage folder is shared by the whole machine and a tool mod
runs one process per signed-in session, so the folder is created with a protected
access control list that gives full access to that user, SYSTEM and
administrators, and to nobody else: two users signed in at once neither overwrite
each other's saved geometry nor can read each other's window titles. If the mod
cannot read the user's SID it saves nothing at all -- sharing the data would be
worse than forgetting it. The journal is a diagnostics aid rather than a history,
so it is capped: once it passes a megabyte it starts over from empty.