Documentation ¶
Index ¶
- Constants
- func Closest[F constraints.Float | constraints.Integer](scales []F, wanted F) F
- func EnsureConfigDir()
- func FindProperty[T any](props map[string]any, key string) (T, bool)
- func GetConfigDir() string
- func GetProperty[T any](props map[string]any, key string) T
- func GetPropertyDefault[T any](props map[string]any, key string, def T) T
- func ModesEqual(a, b Mode) bool
- type DesktopSession
- type LogicalMonitor
- type Mode
- type Orientation
- type PhysicalMonitor
- type Profile
- type Rect
- type Resources
- type State
Constants ¶
const ( MaxAllowedFrequencyDeviation = 0.01 Epsilon = 0.005 // for comparing floats )
const ( PropertyVRRSupported = "vrr_supported" PropertyVRREnabled = "vrr_enabled" )
Variables ¶
This section is empty.
Functions ¶
func Closest ¶
func Closest[F constraints.Float | constraints.Integer](scales []F, wanted F) F
Closest find the closest number in slice to the requested number
func EnsureConfigDir ¶
func EnsureConfigDir()
func FindProperty ¶
FindProperty checks if the properties contains a specific value with the correct type and returns true as the second argument if it was found.
func GetConfigDir ¶
func GetConfigDir() string
func GetProperty ¶
GetProperty returns the value of the property, false/zero value if not found.
func GetPropertyDefault ¶
GetProperty returns the value of the property or the given default if not found.
func ModesEqual ¶
Types ¶
type DesktopSession ¶
type LogicalMonitor ¶
type LogicalMonitor struct { Outputs map[string]Mode `json:"outputs"` Scale float64 `json:"scale"` Orientation Orientation `json:"orientation"` Offset Rect `json:"offset"` Primary bool `json:"primary"` Properties map[string]any `json:"properties,omitempty"` }
LogicalMonitor represents one logical monitor. It can have one or more physical monitors as its outputs, in which case the same logical monitor is cloned to all of the outputs.
type Orientation ¶
type Orientation uint8
const ( OrientNormal Orientation = 0 Orient90 Orientation = 1 Orient180 Orientation = 2 Orient270 Orientation = 3 OrientFlipped Orientation = 4 Orient90Flipped Orientation = 5 Orient180Flipped Orientation = 6 Orient270Flipped Orientation = 7 )
func (Orientation) MarshalText ¶
func (o Orientation) MarshalText() ([]byte, error)
func (Orientation) String ¶
func (o Orientation) String() string
func (*Orientation) UnmarshalText ¶
func (o *Orientation) UnmarshalText(text []byte) error
type PhysicalMonitor ¶
type PhysicalMonitor struct { Vendor string `json:"vendor"` Product string `json:"product"` Serial string `json:"serial"` PreferredMode Mode `json:"preferred_mode"` Modes []Mode `json:"modes"` Properties map[string]any `json:"properties,omitempty"` }
PhysicalMonitor represents one connected physical monitor output.
type Profile ¶
type Profile struct {
Monitors []LogicalMonitor `json:"monitors"`
}
Profile represents a complete monitor layout.
type Resources ¶
type Resources struct { // Monitors maps connectors to connected physical monitors Monitors map[string]PhysicalMonitor `json:"monitors"` }
Resources is the output of the resources command
type State ¶
type State struct {
Monitors []LogicalMonitor `json:"monitors"`
}
State is the output of the state command