Here’s something that sucks:

  1. Plug in external monitor to laptop (Mac OS X Leopard in my case).
  2. Arrange your windows to have the IDE on one screen and browser on another. (Etc etc. Resize, rearrange, fuss, fuss, fuss.)
  3. Unplug monitor to run to a meeting, or whatever.
  4. Goto 1.

I’d like to replace step 2 with “computer remembers exactly how I had it and just puts it back that way”.

(I personally only need a solution for Mac but collecting solutions for other systems here might be useful to others. I’m sure it’s a common problem.)


13 Answers 13


Have a look at Stay by Cordless Dog. I believe it does exactly what you're looking for.

  • 3
    I tried this. It doesn't work for X11 windows but otherwise seems to be as advertised. Thanks for the pointer! It may be that this is the closest we've got to a solution for Mac currently.
    – dreeves
    Commented Dec 5, 2010 at 20:31
  • X11 windows aren't "real" NSWindow instances (at least they weren't last time I checked) so it's not a big surprise that Stay wants nothing to do with them :) Glad it worked out otherwise!
    – Tony Arnold
    Commented Feb 1, 2011 at 11:38
  • 1
    This looks good, but it is not working with fullscreen apps in Lion. I have Safari in fullscreen mode when I have 1 display and after I attach 2nd display, I want to exit fullscreen and move Safari to second display. Stay does not move any fullscreen app.
    – vasco
    Commented Jun 4, 2012 at 8:05
  • 2
    It seemed like a good fit. But with 3 external displays it often had problems with the positions and just solved the problem to 50%. So I still had to do a lot of manual work. I just deinstalled it. Oh, and its only 30 day trial! Commented Apr 28, 2017 at 5:25
  • Has anyone been able to make Stay (AppStore link) work with macOS 12.x or above? Commented Mar 1, 2023 at 0:39

Slate is a very powerful free Mac app that does exactly what you want. When you plug in your secondary monitor, it automatically detects the new monitor, and all of your windows will be moved and resized just the way you like them. You can define custom positions and sizes for all of your applications, including full screen, half screen, and grid-based.

One of the coolest things about Slate is that you can define different layouts based on how many monitors you have connected. For example, if you are using your laptop by itself, you might want to have all of your apps filling the whole screen. But when you have a larger secondary monitor, you might want to split up your screen between your browser, mail, and music. Slate does this easily.

You can also define keyboard shortcuts for specific layouts and actions such as nudging and resizing windows by a certain percentage.

Below is my configuration file. I keep all of my apps at full screen on all of my monitors, but you can change it to make them half or some other size:

# Monitor Aliases
alias mon-laptop    0    # variable for my laptop monitor
alias mon-hp        1    # my external HP monitor

# Window Position Regions
alias hp-full        move screenOriginX;screenOriginY screenSizeX;screenSizeY         ${mon-hp}
alias hp-left        move screenOriginX;screenOriginY screenSizeX/2;screenSizeY         ${mon-hp}
alias hp-right       move screenOriginX+screenSizeX/2;screenOriginY screenSizeX/2;screenSizeY         ${mon-hp}
alias laptop-full        move screenOriginX;screenOriginY screenSizeX;screenSizeY         ${mon-laptop}
alias laptop-left        move screenOriginX;screenOriginY screenSizeX/2;screenSizeY         ${mon-laptop}
alias laptop-right       move screenOriginX+screenSizeX/2;screenOriginY screenSizeX/2;screenSizeY         ${mon-laptop}
alias laptop-righttop    move screenOriginX+screenSizeX/2;screenOriginY screenSizeX/2;screenSizeY/2       ${mon-laptop}
alias laptop-rightbottom move screenOriginX+screenSizeX/2;screenOriginY+screenSizeY/2    screenSizeX/2;screenSizeY/2       ${mon-laptop}

# Window layouts for when I have 2 monitors
layout 2monitor 'Google Chrome':REPEAT ${hp-full}
layout 2monitor 'iCal':REPEAT ${hp-full}
layout 2monitor 'Coda':REPEAT ${hp-full}
layout 2monitor 'Mail':REPEAT ${laptop-full}
layout 2monitor 'Rdio':REPEAT ${laptop-full}
layout 2monitor 'Spotify':REPEAT ${laptop-full}
layout 2monitor 'Evernote':REPEAT ${laptop-full}

# Single monitor window layouts
layout 1monitor 'Google Chrome':REPEAT ${laptop-full}
layout 1monitor 'iCal':REPEAT ${laptop-full}
layout 1monitor 'Coda':REPEAT ${laptop-full}
layout 1monitor 'Mail':REPEAT ${laptop-full}
layout 1monitor 'Rdio':REPEAT ${laptop-full}
layout 1monitor 'Spotify':REPEAT ${laptop-full}
layout 1monitor 'Evernote':REPEAT ${laptop-full}

# Keyboard shortcuts for each layout
bind l:shift;ctrl layout 2monitor
bind g:shift;ctrl grid padding:5 0:2,1 1:2,2

# Auto-detect when a monitor is plugged in or out
default 2monitor count:2
default 1monitor count:1

Here is the list of features from Slate's GitHub page:

  • Highly customizable
  • Bind keystrokes to:
    • move and/or resize windows
    • directionally focus windows
    • activate preset layouts
    • create, delete, and activate snapshots of the current state of windows
  • Set default layouts for different monitor configurations which will activate when that configuration is detected.
  • Window Hints: an intuitive way to change window focus
  • [Beta] A better, more customizable, application switcher.

Here is a great tutorial on how to get the most out of Slate.

  • Can it remember how the windows were positioned from when external monitors where last plugged in and just restore them? The app "Stay" almost does this but it keeps failing to remember windows (particularly Chrome) so I'm still looking for something better.
    – dreeves
    Commented Jul 30, 2014 at 21:48
  • @dreeves Yes, it works for me. I just successfully did that manually, using Slate’s menu items “Take Snapshot” and “Activate Snapshot”; if you click them before and after you put your computer to sleep, you will save and restore all your window positions. From the docs, it looks like Slate can do the “Activate Snapshot” automatically with its default directive. I don’t know if you can automate the “Take Snapshot” part. Commented Sep 15, 2014 at 21:51
  • 2
    I want to point out that for the OPs use case, they can simply click save snapshot and restore snapshot in the menu. As long as there is only one window config you want, it should work fine without messing with anything else.
    – Muhd
    Commented Mar 16, 2017 at 0:22
  • 7
    Slate is not maintained anymore, they suggest to use Hammerspoon now. Commented Jul 26, 2017 at 7:35

Putting this here for posterity. A very small app that does exactly that and nothing more: Memmon (macOS 10.10+).

  • 1
    This is BY FAR the best modern solution. Free and simple. Go give the Github some stars. Commented Apr 8, 2022 at 17:13
  • 1
    I agree, Memmon is the best option: it just works, is simple, open source, and free. Commented Sep 26, 2022 at 2:03

I have solved this with a small AppleScript and the small freeware utility Quicksilver.

  1. Save this small AppleScript in a location that will not change on your computer:

        tell application "Adium"
            tell window "contacts"
                set the bounds to {1281, 200, 1460, 850}
            end tell
            tell chat windows
                set the bounds to {1281, 800, 1800, 1200}
            end tell
        end tell
    end try
        tell application "iTunes"
            set the bounds of the first window to {1750, 520, 2700, 1150}
        end tell
    end try
        tell application "Terminal"
            set the bounds of the first window to {2450, 320, 3180, 950}
        end tell
    end try
        tell application "Firefox"
            set the bounds of the first window to {1460, 20, 2800, 950}
        end tell
    end try
  2. You will need to customize which applications you want on your monitor and the window bounds the way you like them. I'm a programmer and the above configuration is how I run my second monitor.

  3. Install Quicksilver.

    I chose to make it not visible in the Dock, and just run as a small taskbar daemon

  4. Set up a key command in Quicksilver, and drag and drop your AppleScript from step 1 into the window as the action to perform. I bound it to CommandShiftA. Works great!

  • 6
    Not particularly scalable if you have a good number of applications to manage. Nor is it easy to manage! Hard-coding bounds really is no fun.
    – fatuhoku
    Commented Dec 15, 2012 at 18:02
  • Can you set the desktop that the application appears on? Commented Jan 24, 2014 at 12:40
  • The link is dead, found similar app of same name here.
    – John
    Commented Sep 4, 2021 at 13:42

I fixed this without any external application.

All you have to do is make sure your laptop is "Desktop 1" and your External Monitor "Desktop 2"

you can do this by moving the white menu bar to the laptop screen in system preferences > Displays > Arrangement

  • Sadly this doesn't seem to be the case anymore as of 10.13 (High Sierra).
    – Ether
    Commented Jun 1, 2020 at 22:01
  • This works great in macOS Monterey v12.1... the labels are a bit different... use as "Main Display" and "Extended" ... works great. Thank you!
    – Ender2050
    Commented Jan 25, 2022 at 5:07
  • I was wondering why I never had this problem, across 10 years of MacBooks/screens/OSes. This explains it.
    – hmijail
    Commented May 19, 2022 at 23:36

I just followed http://cordlessdog.com/stay/, works great for me, with a little lag though

Once you have stay installed on your mac, you can launch it and store the windows however you want. So whenever you disconnect your displays and connect back, you will have all the windows restored.

You might have to add stay as your startup application, because you will have to launch it every time you restart your mac.


Before you unplug the monitor, close everything that's not entirely on the main monitor. Applications generally save their state (including window placement) when they close, and read it when they open, so if the second monitor is present at both of those times you should be fine.

You can take advantage of applications which allow more than one instance to be open at a time, but only save state on close. Close the multi-monitor instance (which causes the state to be saved). Unplug the second monitor. If you have a second instance running, it should be repositioned onto the main monitor, or you can start another instance. Don't close this instance before plugging the second monitor in again and starting another instance (which would then read the multi-monitor configuration on startup). Then you can quit the single-monitor instance (saving that state), and then the multi-monitor instance (overwriting the single-monitor state).

A more complex option might include figuring out where the state is saved, backing it up, and writing a batch file / script to restore it before opening the application, which would allow you to make a link to do this automatically when you start the application.

Finally, there may be such a utility for your platform, or writing one might not be too complex. For Windows, there is a program called ShiftWindow that can reposition windows either on application startup or on a certain hot-key. I'm afraid I don't know MacOS well enough to say if a similar utility exists. This is probably the ideal solution, second only to having the OS support such a thing directly.

  • 1
    Thanks! Not the answer I was hoping for but a good lead!
    – dreeves
    Commented Feb 13, 2009 at 13:53
  • This is the most elegant solution. No installations and mucking around necessary! Thanks!
    – Yeti
    Commented Oct 12, 2020 at 7:49

On Reddit some users suggested Display Maid. I'm using it on MB Air (M1) connected to Display Link dock with 4K monitor and full HD monitor connected via TB and it's great so far.

  • How is it compared to Stay? I've been using Stay for some years now and have been relatively happy, but always interested in upgraded options!
    – ylluminate
    Commented Jan 14, 2022 at 22:46
  • I have no experience with Stay, but from what I saw on demo video, Stacy's functionality seems very similar.
    – Taz
    Commented Jan 15, 2022 at 23:08

I found an answer on macrumors that works for me without requiring another software.

Preferences -> General -> Uncheck Close windows when quitting an app

The description of what this setting is doing makes sense:

When selected, open documents and windows will not be restored when you re-open an app

I don't know why unplugging and plugging a display counts as "re-opening an app" but this worked for me.

  • the issue is not quitting an app, the issue is unplugging and replugging a secondary monitor while the app stays alive
    – Nir O.
    Commented Nov 28, 2022 at 9:20

At least on Windows, many apps will restore themselves if you maximize them before switching monitors. Leave them alone while you're in the meeting, then restore them after reconnecting.

It's still an incomplete fix (and hassle) but it's the only thing I know to do if I want some chance of resurrecting my carefully placed windows. ShiftWindow sounds intriguing though...

And if you go from two monitors down to one, Alt+Spacebar+M then arrowkeys is a life-saver (Windows again, sorry) if you "lose" your windows.



I found this via Lifehacker, and it works great for me. I'm using the pro version SizeUp as opposed to the free TwoUp, and it's perfect.

  • Are you saying this solves the problem I posed though? The page you linked to doesn't seem to mention anything about that.
    – dreeves
    Commented Jul 24, 2009 at 18:15
  • 1
    No, this doesn’t solve the problem at all. SizeUp makes it quicker to move a window where you want it, but you still have to manually switch between each window and tell SizeUp where you want to move each one. Commented Sep 15, 2014 at 21:59

I'm a Windows user and was looking how to switch off the new Windows 7 feature to move all windows away from the unplugged external monitor. I found the receipt (for ATI video cards) to set all DMMEnableDDCPolling values in registry to 0. It disables the automatical check if the monitor is switched off. Now if the monitor is unplugged and plugged again, all windows keeps in the same position.

Here's the answer which helped me: https://superuser.com/questions/120983/how-to-disable-monitor-auto-detection-in-windows-7 (answer by Alex)

  • 2
    This has nothing to do with Mac?
    – Walt
    Commented Feb 26, 2013 at 15:43
  • 5
    No.. but the question was tagged also as "windows" (although maybe the OP referred to program windows ;)). Anyway, for Windows there are couple of handy utilities for the task. I personally use Basta's ZMover and it has worked well. Another alternative is DeskSoft's WindowManager. But these won't of course help OSX users.
    – Ville
    Commented Sep 3, 2013 at 15:21

Unplug and plug the monitors in the same order.

Unplug sequence: Monitor1 -> Monitor2 Plug Sequence: Monitor2 -> Monitor1

  • It looks like the question specifies only one external monitor connected to a notebook. Does this answer address that?
    – Jake3231
    Commented Feb 18, 2020 at 2:24
  • For Single monitor there is no issue at all on my machine which is running Mojave.
    – abb
    Commented Feb 19, 2020 at 18:51
  • @Jake3231I think the notebook monitor becomes Monitor1 in this case. It worked for me!
    – Yeti
    Commented Oct 12, 2020 at 7:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .