67

I have this problem sometimes with my dual-screen setup, especially when I'm juggling lots of things around.

Occasionally I seem to be able to move a window entirely off-screen (I'm not quite sure how) and I can't get it back. If I do a 'hide all' in the application's menu (usually it's Mail.app, so let's stick to that one for the example), everything disappears and Mail seems to think it's got an 'inbox' window in the Windows menu, but there's nothing visible. Closing and restarting the app doesn't seem to help (as the app is helpfully remembering where my window previously was) and all I end up doing is shutting down the Mac, unplugging the second monitor and restarting it, opening the application again and this seems to persuade the Mac to rethink the main window position, and all is well. I can then restart the second monitor, etc.

Is there a better way? Is there some way of marshalling windows back to a specific monitor, or a utility for moving 'open'/running windows? Am I actually doing something wrong? :-)

I'm not using Spaces, by the way - so I'm pretty sure this isn't some weird Spaces issue. :-)

23 Answers 23

57

Chealion answered this on SuperUser.

I won't copy and paste his answer here, as he got the credit not me.

But basically, what you could do is (quoted from Chealion's answer) :

A second method of arranging the Windows so you can see them (if for some reason they're staying off screen) is to change to the application that owns the window in question, hold the Option key down and choose "Arrange in Front" from the Window menu. It will then arrange all the windows of that application in a cascade from the top left of the screen.

7
  • 3
    This solution doesn't work in Yosemite, you can only access the Window menu from the display that the window is on in Yosemite.
    – ShemSeger
    May 7, 2015 at 15:02
  • 6
    The menu option doesn't appear for XQuartz
    – Mead
    May 11, 2015 at 2:44
  • 3
    Apple seems to have removed this feature as of MacOS 10.13.5. It's almost like being able to get windows that have moved off-screen is considered a bug, instead of the fact that they can be moved off-screen. Sep 19, 2018 at 19:21
  • 1
    No such menu item in macOS Catalina
    – clearlight
    Nov 6, 2019 at 2:18
  • 2
    I'm on macOS Catalina. Option + Click on app icon worked for me! The menu item may be hidden in newer versions of macOS but I think that key + click combo does the same thing. Jul 23, 2020 at 20:14
20

For completeness:

From my answer originally at Server Fault Question 7237:

When a monitor is unplugged (including the adapter as well if applicable - leaving the adapter leaves OS X thinking the monitor is still plugged in) all the Windows should move onto your main screen. Occasionally some windows (eg. Firefox) will keep their position on the very far right of the screen leaving you just enough room to grab the title bar and move it where you'd like to.

One method is before you unplug the external monitor (or before you unplug the dongle) is to open up the Displays Preference Pane in System Preferences and click on the "Gather Windows" button. This is supposed to bring every window on the main screen and the option does not appear if you don't have a second monitor plugged in.

A second method of arranging the Windows so you can see them (if for some reason they're staying off screen) is to change to the application that owns the window in question, hold the Option key down and choose "Arrange in Front" from the Window menu. It will then arrange all the windows of that application in a cascade from the top left of the screen.

Lastly, there are several AppleScripts available (eg. this one at Snipplr) that will also grab every window off screen and move it on screen for you.

There is also a nifty shareware app called Stay that will help automate a lot of this for you, while there is also MarcoPolo which will do much more than just notice if a monitor is disconnected and allows you to run scripts (in case you want to do more than just rearrange the windows).

1
  • 1
    I'm sorry but I have no idea what you're talking about. change to the application that owns the window in question, hold the Option key down and choose "Arrange in Front" from the Window menu I don't see that anywhere Jan 9, 2020 at 19:40
14

I thought I should make an answer to this that describes solutions specifically for XQuartz. Many of the solutions here do not work for XQuartz. From this ticket: https://xquartz.macosforge.org/trac/ticket/796 , I've found two solutions that work and I feel it would be beneficial to state them here.

  1. If you can unplug/plug-in your monitor easily, then unplug your monitor so that your window appears in a spot that you can access. Then, with your mouse, click on the window and hold down the mouse button as if you are going to drag it. Without letting go of your mouse or the window, plug in your monitor. The XQuartz window should stay where your mouse is.

  2. This ShiftIt package works very well for getting windows that have disappeared off-screen: https://github.com/fikovnik/ShiftIt/downloads There may be other similar packages, but this one is clean and effective.

Hope this helps someone!

1
  • Shiftlt works almost with XQuartz. It actually re-center the main window of (e.g.) Inkscape but not the secondary window (property dialog). A nice tool to know however. +1
    – lauhub
    May 18, 2016 at 19:11
7

I have two screens and loading Inkscape usually puts it somewhere inaccessible. I can see it by using "show all windows", but if I select it from there it goes and disappears again. The solution I found came from this mailing list comment.

When unplugging the second screen I can see Inkscape. But then even after moving it around a little, if I plug the other screen back in it disappears off the edge again. The solution is:

  1. Unplug the second screen
  2. Use the mouse to take hold of the title bar of the window (click and hold)
  3. While still holding on to the title bar, plug the monitor back in
1
  • I'll add that I get a lot of stares from other people around the office while performing this task.
    – tremby
    Aug 24, 2016 at 21:40
5

I found a really easy fix for this.

It happened to me on Powerpoint. I went to the Powerpoint menu at the top of the screen. Clicked “Window” and then clicked “Zoom in Window”. Done

3
  • This is the only answer that worked for 10.11.5 (code name El Capitan).
    – pzulw
    Jul 18, 2016 at 18:24
  • Alternatively, Window > Zoom just worked for me (Zoom in Window wasn't an option). Feb 21, 2019 at 15:15
  • Window > Zoom works in Mojave
    – pmneve
    Apr 7, 2020 at 1:00
4

Something I tried and it worked for me is switching the resolution to a lower one and then bring it back up. And it just magically puts the application to centre. Cheers.

0
3

Also, for completeness, I came across this: Stay app for Mac although I haven't tried it or bought it yet.

From their website:

Stay can store a set of windows for every combination of displays that you use with your computer. For example, if you have a laptop that is sometimes connected to an external monitor, you can store two sets of windows in Stay; one with the external monitor connected and one without. This done, you’ll be able to ensure that your windows are always where you want them to be by having Stay restore windows whenever you connect or disconnect the external monitor. Stay can even be configured to automatically restore windows as displays are connected and disconnected.

3

I found this application : WindowWrangler

It allows one to use keyboard shortcuts to move the window.

Unfortunately, it does not work for the only window I need: Inkscape in an XQuartz environment.

4
  • 2
    Did you find any solution for xquartz? Apr 17, 2014 at 10:08
  • The solution I found was to connect an external monitor: in that case, the window changed is position in a way I could move it. I move it so that, after disconnecting the screen, the window top bar is "accessible".
    – lauhub
    Apr 17, 2014 at 10:10
  • @gebirgsbärbel See the answer I just posted below. I think you may find it useful.
    – nukeguy
    Apr 9, 2015 at 13:37
  • @gebirgsbärbel See the [new answer] (apple.stackexchange.com/a/238975/31154) I posted below, using xdotool utility, that finally solved all my problems
    – lauhub
    May 20, 2016 at 12:04
3

A friend of mine wrote a free tool for bringing back the windows, if you want to check it out, go here: http://bring-em-back.com

1
3

For specific X11/XQuartz problem, here is a solution I found.

Pre-requisite

First, you will need xdotool. One can install it using brew install xdotool

The basics

You can move a window to left using the following script:

xdotool getactivewindow windowmove --relative -- -100 -44

-44 is a value that I believe is the sum of title bar height and menu bar height. If not set here, the window will go down instead of keeping y position.

For right move:

xdotool getactivewindow windowmove --relative -- 100 -44

To move up :

xdotool getactivewindow windowmove --relative -- x -100

To move down :

xdotool getactivewindow windowmove --relative -- x 100

So now, you can move the currently selected window (which you could access using Expose by clicking on it if it is off-screen).

Expose view

You can then open terminal and repeat the commands until the window appears.

Access it via shortcut

To make your window move using keyboard shortcut, you can use the explanation given here

I actually added these shortcut using BetterTouchTool.

  1. BetterTouchPreferences > Keyboard

  2. Add New shortcut

  3. Select Keyboard shortcut textfield and press (e.g.) shift+^+cmd+

  4. Select Trigger Predefined Action: Controlling Other Applications > Execute Terminal Command

  5. Enter the command for (e.g.) right move with the complete path to xdotool (you can obtain it using which xdotoolcommand)

    /usr/local/bin/xdotool getactivewindow windowmove --relative -- 100 -44

  6. Click the save button.

Repeat the same for other directions and enjoy !

1
  • fink doesn't have xdotool
    – Mei
    Sep 20, 2017 at 21:44
2

I have a solution that worked for me and I trawled forums and tried everything I could possible.

In the end I found a way. Install an app called BetterTouchTool. This allows you to make a shortcut to do various handy things with your screen etc. Then setup an app specific shortcut (much easier than it sounds), and make it simple. I set it so that a "two finger swipe- up" led to a "Maximise window" action. This stuck the missing application on to my laptop screen and away from the phantom monitor screen it had been stuck on.

Problem solved.

Here's an image of what BetterTouchTool looked like when I'd set the shortcut up:

BetterTouchTool Shortcut

1
  • I also fix the problem using BetterTouchTool.
    – Eugenio
    Oct 13, 2018 at 11:57
2

I just had this same problem in Mavericks, I managed to solve the problem by following these steps:

  1. Take the pointer to an edge of the window that moved off screen, for example to the edge on the right.
  2. When you see the resize icon (in my case the horizontal resize icon) click and hold.
  3. While "holding down the click" drag the window. Voila!
1
  • This only works if the window is against the edge of the other window
    – Mei
    Sep 20, 2017 at 21:36
2

It seems that this happens to me most often when the secondary display is "above" (in System Preferences -> Display -> Arrangement). When the problem happens if I move the external display "to the right" then the X11 windows reappear.

2

In El Capitan the simple answers here didn't work for me or weren't available as options. What did work was to right-click the app in the Dock (Chrome in my case) and select Options > Assign to Desktop on Display 1. This moved all of the windows to my current desktop.

2

In Yosemite, if worked for me to

  1. open System Preferences
  2. open Display < Resolution
  3. select 'Scaled'
  4. change the setting to anything else temporarily

For me, this was enough to force the application back on screen.

1
  • This simple trick did the fix. Thank you!
    – devav2
    Apr 10, 2021 at 5:36
1

A bit weird though that a window (Terminal in my case) got lost in the arrangement. I tried zoom, bring all to front, but nothing seemed to work.

Finally the Window → Merge All Windows did the trick.

1

This works for me on Mac:

  1. do the 'three finger spread' trackpad gesture (not sure what the technical name for it is) to show the applications on each screen;
  2. drag Photoshop from my laptop screen to my external monitor screen.

Initially, the Photoshop header bar is still off screen, but as soon as you click anywhere on Photoshop, it adjusts itself.

0

You can create a simple app to do it in the AppleScript Editor. Enter the following text and save it as an app. If you put it in your Applications folder it will be easy to access via SpotLight. I named mine gather windows.

property processesToIgnore : {}
tell application "Finder"
    set _b to bounds of window of desktop
    set screen_width to item 3 of _b
    set screen_height to item 4 of _b
end tell
tell application "System Events"
    set allProcesses to application processes
    set _results to ""
    repeat with i from 1 to count allProcesses
        set doIt to 1
        repeat with z from 1 to count processesToIgnore
            if process i = process (item z of processesToIgnore) then
                set doIt to 0
            end if
        end repeat
        if doIt = 1 then
            tell process i
                repeat with x from 1 to (count windows)
                    set winPos to position of window x
                    set _x to item 1 of winPos
                    set _y to item 2 of winPos
                    if (_x < 0 or _y < 0 or _x > screen_width or _y > screen_height) then
                        set position of window x to {0, 22}
                    end if
                end repeat
            end tell
        end if
    end repeat
end tell
1
  • 1
    For completeness you'll need to explain how to get around "Script Editor is not allowed assistive access" (Yosemite)
    – jcollum
    Aug 12, 2015 at 16:36
0

Another solution for XQuartz:

brew install wmctrl
wmctrl -i -r $(wmctrl -G -l | grep -i inkscape | cut -d' ' -f1 ) -e 0,0,0,100,100

Replace 'inkscape' with whatever you want.

0

Here is an easy answer that takes 15 seconds and is a permanent fix.

https://groups.google.com/forum/#!topic/eggbotuser/48RbZ2Pey5A

This problem shows up if you have multiple displays. The document is opened, its just way off to the left, off-screen of all displays. You can’t fix this with Applescript: XQuartz doesn’t implement the standard scriptability verbs to get and set the position of windows. It also doesn’t implement the standard X11 window manager equivalents.

The problem’s cause is a conflict between a preference setting in Inkscape and a preference setting in Mavericks.

The out-of-the-box preference setting for Mavericks in System Preferences > Mission Control is [x] Displays have separate Spaces

The out-of-the-box preference setting for Inkscape in its menu bar File > Inkscape Preferences > Windows is (•) Save and restore window geometry for each document.

If you change the OS X preference (requires Logging out, and Logging back in), or you change the Inkscape preference to (•) Don’t save window Geometry (Which you can’t do unless you can get Inkscape to show you a window) the Inkscape performs as expected.

So, if you want Mavericks' new behavior with multiple displays on your Mac, then temporarily revert to the old way, change an Inkscape preference, then set Mavericks back to a menu bar on each screen.

0

Under the application's menu item 'Window', select "Arrange All". This worked for Microsoft PowerPoint for Mac, it may not work for all.

0

I have a similar issue in my Mac when opening MS Powerpoint as it won't show on screen. The simplest way is to go to the Menu Bar of Powerpoint on the top of your Mac screen and click "Window" then under that click "Arrange All". The missing/hidden PowerPoint windows will show

0

The simplest solution I've found to this problem is to right click on the relevant icon in the Task Bar and then select 'Hide'. You can then do the same and select 'Show' and then your missing window reappears.

1
  • This did not work for me.
    – elexhobby
    Dec 4, 2020 at 21:24

You must log in to answer this question.

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