xrandr/current_arrangement.go

29 lines
573 B
Go
Raw Permalink Normal View History

2023-12-18 23:08:42 +01:00
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,
}
}