Package xinerama provides a convenience function to retrieve the geometry of all active heads sorted in order from left to right and then top to bottom. While Xinerama is an old extension that isn't often used in lieu of RandR and TwinView, it can still be used to query for information about all active heads. That is, even if TwinView or RandR is being used, Xinerama will still report the correct geometry of each head.
Alias so we use it as a receiver to satisfy sort.Interface
PhyiscalHeads returns the list of heads in a physical ordering. Namely, left to right then top to bottom. (Defined by (X, Y).) Xinerama must have been initialized, otherwise the xinerama.QueryScreens request will panic. PhysicalHeads also checks to make sure each rectangle has a unique (x, y) tuple, so as not to return the geometry of cloned displays. (At present moment, xgbutil initializes Xinerama automatically during initial connection.)
Len satisfies 'Len' in sort.Interface.
Less satisfies 'Less' in sort.Interface.
Swap does just that. Nothing to see here...