Commit fe03931
committed
Make workspace assignment on adding monitors more stable.
Previously, `rearrangeWorkspacesOnMonitors()` mapped new screens to old
screens in a greedy fashion. For each new screen, it would assign the
closest old screen and remove that old screen from consideration for all
subsequent new screens.
This can result in suboptimal workspace placement. For example, if
`newScreens[1]` is an exact match for a given old screen O, but O also
happens to be the closest screen to `newScreens[0]`, then O would be
assigned to `newScreens[0]`. This can result in workspaces jumping
around unexpectedly when adding a monitor.
Fix this by assigning each old screen to the closest new screen, and on
collisions, preferring the closest old screen.1 parent a824164 commit fe03931
1 file changed
+8
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
168 | | - | |
169 | 167 | | |
170 | 168 | | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
175 | 176 | | |
| 177 | + | |
176 | 178 | | |
177 | 179 | | |
178 | 180 | | |
| |||
0 commit comments