29 lines
573 B
Go
29 lines
573 B
Go
package xrandr
|
|
|
|
func (c *Config) Arrangement() *Arrangement {
|
|
a := map[string]*DisplayArrangement{}
|
|
|
|
for _, config := range c.Displays {
|
|
a[config.Port] = config.Arrangement()
|
|
}
|
|
|
|
return (*Arrangement)(&a)
|
|
}
|
|
|
|
func (c *DisplayConfig) Arrangement() *DisplayArrangement {
|
|
off := c.Resolution == nil
|
|
if off {
|
|
return &DisplayArrangement{Off: off}
|
|
}
|
|
|
|
return &DisplayArrangement{
|
|
Off: off,
|
|
Primary: c.Primary,
|
|
Position: c.Position,
|
|
Resolution: c.Resolution,
|
|
Rate: c.ActiveMode.Rate,
|
|
Rotation: c.Rotation,
|
|
Reflection: c.Reflection,
|
|
}
|
|
}
|