Skip to content
This repository was archived by the owner on May 18, 2026. It is now read-only.
This repository was archived by the owner on May 18, 2026. It is now read-only.

Window layout collapses to workspace 1 after sleep/wake #11

@faustozamparelli

Description

@faustozamparelli

When the Mac goes to sleep and wakes back up, all windows that were distributed across separate workspaces get collapsed back into workspace 1 in a random, unpredictable order. The entire virtual layout built up during the session is lost, and there is no way to recover it short of manually reassigning every window to its workspace again.

Expected behavior

The workspace and column layout should survive a sleep/wake cycle. Each window should reappear on the workspace it was assigned to, in the column order it occupied before sleep. Ideally the focused workspace should also be restored.

What likely happens under the hood

From what I understand, miri maintains its layout model entirely in memory and does not use native macOS Spaces. When the system sleeps and wakes, macOS repositions windows itself (especially if the display configuration changes even briefly during the sleep cycle), which puts all windows back on the primary display area and invalidates miri's internal model. On wake, miri sees windows in positions it no longer recognizes and has no persisted state to fall back on.

Steps to reproduce

  1. Set up windows across multiple workspaces (e.g. a terminal on workspace 1, a browser on workspace 2, a music app on workspace 3)
  2. Let the Mac go to sleep (lid close or system sleep)
  3. Wake the Mac
  4. All windows are now on workspace 1 in an arbitrary order

Environment

  • macOS version: 26.4.1
  • miri version/commit: 0.0.3

Feature request: per-app workspace pinning

As a companion to layout persistence, it would be very useful to support a workspace key in the rules config so that a given app is automatically placed on a specific workspace every time it is opened (or every time miri picks it up). This way, even if the persisted layout state is lost or corrupted after a sleep/wake cycle, apps would at least land on their intended workspace on relaunch rather than piling up on workspace 1.

A rough idea of what this could look like in miri.config.json:

{
  "rules": [
    {
      "bundle_id": "com.apple.Safari",
      "workspace": 2
    },
    {
      "bundle_id": "com.spotify.client",
      "workspace": 3
    }
  ]
}

This would make miri much more resilient in everyday use even while full layout persistence is not yet implemented, and would complement it naturally once it is.


Thanks for the work on this maria — it's soooo good.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions