Skip to content

Conversation

@adamjhf
Copy link

@adamjhf adamjhf commented Dec 28, 2025

On wake with external displays, macOS can send multiple ScreenParametersChanged and SpaceChanged events in interim states as external displays reconnect, including changing space IDs multiple times for displays.

This PR attempts to fix this by preventing layout updates while spaces are still updating following wake, with a 5 second grace period to pick up any display reconnections.

This mostly fixes #217 for my setup.

@adamjhf
Copy link
Author

adamjhf commented Dec 29, 2025

Failing tests are failing on main.

@brianwk
Copy link

brianwk commented Dec 29, 2025

Is adding a delay a good solution though? What about tracking another way like the display UUID which doesn't change? Can you detect the space ID change by comparing the UUID? Just wondering and providing food for thought.

@adamjhf
Copy link
Author

adamjhf commented Dec 29, 2025

This code is remapping changes in space ID during the wake process.

The problem is that displays can disconnect and reconnect multiple times following wake (space IDs changing each time), via ScreenParametersChanged. How to distinguish when this is part of the waking process vs. later when e.g. a display may be intentionally disconnected and you want the space destroyed?

@acsandmann
Copy link
Owner

this is a hard issue lol. i think we might need to start trying to see if the contents of a space are the same (hash/etc) to identify spaces that might have changed ids as the displays change. also macos sends "fake" display events that kind of mess up any deterministic approach to this. this is why fixing the windows spazzing between displays issue is so hard because there is lots of conflicting information.

@brianwk
Copy link

brianwk commented Dec 29, 2025

What macOS API does Rift use to determine the displays? Is it CoreGraphics? How do other tiling WM like aerospace handle it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Window layout resets on external displays on wake from sleep

3 participants