How can I force an application to be launched to the 2nd monitor?

macOS X 10.10.1 Yosemite.

How can I force a newly launched application to open to a specific monitor?

Followup questions: Failing that, how can I force a new window that a current application is opening to open in a specific monitor?

And how can I move a borderless window?


My specific situation:

I have a two-monitor set up. My games open in "Full Screen" mode and make the second monitor useless. The game in Windowed mode does not have the green full-screen button available in the top left. However, it does allow me to set a custom resolution and set it in borderless mode.

So I've set the game's resolution to 1920x1060 (my monitor's resolution minus 20 pixel height to account for the menu bar at the top). If I launch this game with borders, I can move the window wherever I want, but I also have to look at the border around the edge of my screen the entire time, which I'd rather not do. Plus, for some reason, the game handles edge-scrolling significantly better in borderless (or full screen) versus windowed mode.

I can't seem to figure out how to get the game onto my second monitor. My first monitor has the dock on the left side, and that's where I want the dock to be. But the game launches to this first monitor, and the dock sits over top of it. I don't want to autohide the dock. I don't want the dock in another position.

I'm looking for more control over this windowing system.


When the app is on the dock do left click on it and it will appear a menu. Select Options → Assign To Desktop on Display 2.

enter image description here

Alternatively, I used Moom, that let me move a window from one monitor to another with a defined shortcut. In my case +. But this is a paid software.

enter image description here


Make any application start on the other monitor:

I'm using macOS Mojave 10.14. Consider the simpler solutions first:

  1. First decide which screen is your default by choosing the default monitor, maybe you can solve your problem by switching default monitor. Go to System Preferences -> Displays -> Arrangement. The Screen with the horizontal white bar is the default. Toggle that.

  2. Second, see if your app has an internal window manager, like iterm2 and chrome browser does. Look through app system settings or profiles. This is application specific and may not have anything.

  3. There are many 3rd party apple window management systems, some free and some paid. Install them and they will attempt to impose controls over how these programs start and stop and impose desktop location, window sizing and window positioning. Careful as these programs may fight each other.

If none of the prepackaged solutions above are good enough:

You want total control over program start, window sizing, window positioning, window re-positioning, and program end from background scripts.

Pull out the power tools on Apple's Quartz Compositor Windows management system through apple's osascript tool:

Make a new file demo.scpt with this in it:

#this logs text to stdout
log("foobar")
#define a variable
set moo to 9
log(moo)
#get the window dimensions of the Iterm2 window:
tell application "Iterm2" to set window_geometry to (get the bounds of the front window)
log(window_geometry)
tell app "Finder" to display dialog "hello world"

Run it like this from the terminal:

osascript demo.scpt

The result of this little script reports the screen geometry of the Iterm2 window, and a screen pops up saying hello world. Read the osascripting guide on how to pass parameters to choose monitor, sizing, positioning, anything the OS can see. If osascript has sudo access, then it grants full read and modify access to the Quartz Compositor Windows management system.

Using osascript to keep one foot in unix shell, and the other foot in the apple window management system, it appears to be turing complete as everything is visible and modifiable via scripting, you just have to read window geometry and apply window geometry on application start.

Apply window positioning on open

tell application "System Events"
    set position of first window of application process "Preview" to {10, 10}
    set size of first window of application process "Preview" to {500, 1000}
end tell

Run it osascript demo.scpt and the Preview window is repositioned.