Skip to content

Screen ordering with an "unusual" display configuration #1583

Description

@jfcantu

I am not 100% sure if this is a bug, because I'm not sure of the intended behavior here.

I recently got a second monitor for my home office. With this, I discovered Rectangle doesn't order them quite the way I'd expect. My new screen layout is as follows:

|A|
|B|C|

This is the order I'd expect Rectangle to use when determining "next screen" (A->B->C->A). But it goes in the opposite order (C->B->A->C). From what I can tell, screen order is determined here:

func order(screens: [NSScreen]) -> [NSScreen] {
let sortedByY = screens.sorted(by: { screen1, screen2 in
return screen1.frame.origin.y < screen2.frame.origin.y
})
let alsoSortedByX = sortedByY.sorted(by: { screen1, screen2 in
return screen1.frame.origin.x < screen2.frame.origin.x
})
return alsoSortedByX
}

If I'm reading the code and Apple documentation right (and bear with me, I've never used Swift or done Mac UI coding before), it orders screens by their X/Y origins (descending), prioritizing X-origin - which does indeed result in the actual screen order being calculated as C->B->A.

So I guess my question is, what's the intended behavior here? It seems more intuitive to me to go top-to-bottom, left-to-right (and, admittedly, this only really becomes an issue when you combine the two as I've done here.)

If this is the intended behavior - then would you accept a feature PR to override the default ordering?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions