23

When re-opening an app, all of its windows end up on the first Space, regardless of their original placement:

Original layout: one app has two windows open, each in a separate Space

+-----[ Space 1 ]-----+  +-----[ Space 2 ]-----+
|                     |  |                     |
|  [Chrome window 1]  |  |  [Chrome window 2]  |
|                     |  |                     |
|                     |  |                     |
+---------------------+  +---------------------+

Incorrect layout after app restart: both windows are in the first Space

+-----[ Space 1 ]-----+  +-----[ Space 2 ]-----+
|                     |  |                     |
|  [Chrome window 1]  |  |                     |
|  [Chrome window 2]  |  |                     |
|                     |  |                     |
+---------------------+  +---------------------+

Is there a setting or an app that would make it possible to have apps restore their windows in the Spaces they were originally located before the app was quit?

  • If you're going to give separate spaces to individual windows, couldn't you just use full-screen mode, which essentially does the same thing? – William T Froggard May 28 '15 at 15:09
  • 4
    Full-screen is not what I'm looking for. My typical workflow is to have a dedicated Space for each project I'm working on. So I have many active Spaces, each of which usually has a Chrome window, an editor window, a terminal window, etc. And I don't want to spend time distributing windows across Spaces every time I reboot, restart an app, or an app crashes. So I'm really interested in just what you see in the diagram above: to have apps or the OS remember which Space each individual window was before an app was quit. – Jakub May 28 '15 at 16:56
  • 10
    Not sure why people are having issue with OP's question. I get impression that people don't understand how Spaces and Mission Control works. From my perspective, I see the OP's issue frequently, and the behaviour is inconsistent across various applications, such as Safari and Finder windows. Sometimes the windows go to their various Spaces, and sometimes not. – Vzzdak May 28 '15 at 16:59
  • @Vzzdak Good point about the behaviour being inconsistent. Forgot to mention that. – Jakub May 28 '15 at 17:46
  • Although this question is from 2015, it is still completely relevant in 2019. It's not just Chrome. I see the same issue with Finder windows, for example. – Jamie Cox Jul 27 at 23:44
5

There is a bug #74812 in Chromium. Vote for it!

Same question on Superuser.

0

I am aware that my answer doesn't address your issue but it is a close workaround. I am using a software called Cinch and SizeUp to reposition windows. Resizing a window across space and screen is really fast and is done using keyboard shortcut.

The software comes with a trial version for you to test it. http://www.irradiatedsoftware.com/sizeup/

0

I don't have a complete answer, but today, I started a decent stab at this issue using applescript. The following Applescript does roughly half the job. It reports all the windows of every application open on every desktop. The next step is to record all this in a file and then implement a script to redistribute the windows after reboot:

--This applescript reports a list of application windows present on each desktop
--This is only a sample script intended to eventually be used to restore all application windows to their pre-reboot desktops

tell application "System Events"

    set windows_string to ""
    set numDesktops to (first paragraph of (do shell script "strings ~/Library/Preferences/com.apple.spaces.plist | grep -c ^\\\\$")) + 1
    --the following tcsh command can determine the number of desktops:
    -- @ x = ( `strings ~/Library/Preferences/com.apple.spaces.plist | grep -c '^\$'` + 1 ); echo $x

    -- switch to the first desktop:
    repeat with aDesktop from 1 to numDesktops
        key code 123 using {control down}
    end repeat

    repeat with aDesktop from 1 to numDesktops

        set windows_string to windows_string & return & return & "Desktop " & (aDesktop as string) & return
        delay 1
        get (the name of every application process whose class of windows contains window)

        repeat with P in the result

            set windows_string to windows_string & return & return & P & return

            get (every window of process (contents of P) whose value of attribute "AXMinimized" is false)

            repeat with W in the result

                set window_name to ((name of W) as string)

                --Stickies window names can be multi-line, so this trims from the first hard return onward
                set better_window_name to (my replacePattern:"[\\n].*" inString:window_name usingThis:"")
                if window_name is not equal to "" then
                    try
                        set windows_string to windows_string & better_window_name & return
                    on error
                        set windows_string to windows_string & "couldn't get window name" & return
                    end try
                end if

            end repeat

        end repeat

        --switch to the next desktop
        key code 124 using {control down}

    end repeat

    display dialog "List of windows on this desktop: " & return & return & windows_string

end tell

--Call like this: set res to my replacePattern:"\\s+" inString:"1 subtratcing-these: -2 3 4" usingThis:"-"
use framework "Foundation"
use scripting additions

on replacePattern:thePattern inString:theString usingThis:theTemplate
    set theRegEx to current application's NSRegularExpression's regularExpressionWithPattern:thePattern options:0 |error|:(missing value)
    set theResult to theRegEx's stringByReplacingMatchesInString:theString options:0 range:{location:0, |length|:length of theString} withTemplate:theTemplate
    return theResult as text
end replacePattern:inString:usingThis:

Here's an example of what's the the resulting dialog I get:

List of windows on this desktop: 



Desktop 1


iTunes
MiniPlayer


FluidApp
Found 626 tickets


Stickies
useful commands
System Config Notes
Special characters
Profile where a python scri…
XEMacs Tricks
Terminal Tips


Messages
Messages (3 unread)


FluidApp
Found 626 tickets


Slack
Slack - Princeton NPLC


FluidApp
Found 626 tickets


Desktop 2


iTunes
MiniPlayer


FluidApp
Found 626 tickets


Stickies
DAI


Messages
Messages (3 unread)


FluidApp
Found 626 tickets


Slack
Slack - Princeton NPLC


FluidApp
Found 626 tickets


Desktop 3


iTunes
MiniPlayer


Finder
Searching “Scripts”
Searching “Scripts”
Searching “Scripts”


FluidApp
Found 626 tickets


Stickies
RPST
Issues to resolve with RPST…


Messages
Messages (3 unread)


FluidApp
Found 626 tickets


Terminal
Terminal — -csh


TextEdit
Untitled 35.txt
Untitled 34.txt
Untitled 27.txt
Untitled 15.txt


Slack
Slack - Princeton NPLC


Safari
AppleScript: Essential Sub-Routines
Using Applescript to Execute a Complicated Keystroke - Stack Overflow
How to restore windows to their original desktops after reboot? - Ask Different


Script Editor
Untitled.scpt
Untitled 4.scpt
Untitled 3.scpt
paste_file_contents.scpt
Untitled 2.scpt


FluidApp
Found 626 tickets


Automator
Subtract.workflow (Quick Action)


Desktop 4


iTunes
MiniPlayer


FluidApp
Found 626 tickets


Stickies
GALAXY


Messages
Messages (3 unread)


FluidApp
Found 626 tickets


Terminal
Terminal — -bash
???c7??? 8yc`?h=??'?]b?c??k?k????Ԫ??m??d+ — -bash


Slack
Slack - Princeton NPLC


FluidApp
Found 626 tickets


Desktop 5


iTunes
MiniPlayer


FluidApp
Found 626 tickets


Stickies
TREEVIEW
When you start to work on a…
TreeView stats, legend, & d…
DATE OF SUBMISSION: 


Messages
Messages (3 unread)


FluidApp
Found 626 tickets


Slack
Slack - Princeton NPLC


FluidApp
Found 626 tickets


Desktop 6


iTunes
MiniPlayer


FluidApp
Found 626 tickets


Stickies
ALIZZI


Messages
Messages (3 unread)


FluidApp
Found 626 tickets


Slack
Slack - Princeton NPLC


FluidApp
Found 626 tickets


Desktop 7


iTunes
MiniPlayer


FluidApp
Found 626 tickets


Stickies
GARCIA


Messages
Messages (3 unread)


FluidApp
Found 626 tickets


Slack
Slack - Princeton NPLC


FluidApp
Found 626 tickets


Desktop 8


iTunes
MiniPlayer


FluidApp
Found 626 tickets


Stickies
EMILIA


Messages
Messages (3 unread)


FluidApp
Found 626 tickets


Slack
Slack - Princeton NPLC


FluidApp
Found 626 tickets

You must log in to answer this question.

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