Opening Chrome window in specific desktop

I use gMail in Chrome for email and want to keep that in “desktop 1”. It’s open all the time. However in my primary desktop (“desktop 2”) I want to be able to use Chrome in a more siloed way:

  • Keyboard shortcut to show/hide Chrome and activate new window if there is none
  • This KB shortcut would not affect the Chrome window in desktop 1

I can get Chrome to open the window in the right desktop by using the open file/application action. I can’t get the logic to work to open a new window if there is not a currently active one, do you know if that is possible?

I can’t get it to work, it keep bouncing me back to the space 1 when I activate Chrome etc. Any ideas, thanks!

Is this not possible?

Unfortunately, Apple has not published any API for controlling Spaces, so Keyboard Maestro is very limited in what it can do to help you solve this sort of problem.

Unless you can devise a sequence of clicks or keystrokes to accomplish your goal, it is probably not possible with Keyboard Maestro.

There may be other tools that are not concerned about using only published APIs which might be able to use some private APIs to do something.

If I don’t full screen Chrome I can program a keyboard shortcut to move to “space 1”.

The issue I am having is the behavior of Chrome. I want one keyboard shortcut to move to Space 1 and show Chrome which has gMail loaded up. I want a different KB shortcut to show/hide/open Chrome in the main desktop (“desktop 2” for me). The problem is it keeps trying to put the focus back in the Chrome window in desktop 1. I can’t seem to silo the app to just one space.

Does that make sense?

![]( “Title”)

Hey Brandon,

You cannot control which space an app’s windows will open in.

Apple has not provided a means to script this.

If an app is already open in one space then activating it will switch to that space.

It would be nice if you could do something like this (pseudocode)

set spaceList to name of spaces
if spaceList contains "Gmail-Space"
    activate space "Gmail-Space"
end if


tell application "Google Chrome"
  make new window in space "Desktop-2"
end tell

But Apple has not provided a means to do this.

Some utilities provide more control over spaces than Keyboard Maestro, but those utilities are not using public APIs (and are therefore hacking the system to some degree). Peter will ONLY use public APIs and will NOT hack the system, because hacking the system means constantly fighting Apple to get your software to work with no guarantee they won’t break something permanently that you depend on.

You can always go to Apple Feedback and ask for features:


It is pretty hacky but I was able to get what I want using Chrome user profiles. I have one just for email and one for everything else. The KBM is using the select menu command.

I created keyboard shortcuts to move between spaces in system preferences.

It snot perfect but works pretty well. Thanks for the help!

I wasn't sure if you meant you already had a macro that created a Chrome window where you want it, but here's one that opens a new Chrome window in a specific space. I don't think there's anyway to find out the current space or move a window to it by scripting, including using AppleScript.

Keyboard Maestro “Chrome New Window on Specified Desktop” Macro

Chrome New Window on Specified Desktop.kmmacros (10 KB)

By the way, it looks like once you have an application’s window in the space you want it, if you are in that space with the application frontmost, clicking new window gets you a new window in that space, not the space to which the application is assigned. At least that happens in Safari and Chrome — I haven’t checked other applications yet. So you probably don’t really need an elaborate macro — make Chrome active, open a window, and if it’s in the wrong space, simply press and hold its title bar while pressing the shortcut key assigned in the Mission Control section of the Shortcuts Tab of the Keyboard System Preference, the release the mouse. Subsequent new windows while you are in that space will appear in that space.