display

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package display reads and changes the target monitor through the operating system: its modes, its gamma table and whether it is lit. display_darwin.go and display_windows.go implement Target and the Monitor methods.

Index

Constants

This section is empty.

Variables

View Source
var ErrGammaLimited = errors.New("display: the system limited the dimming")

ErrGammaLimited means the system refused the requested dimming and a milder one was applied: Windows keeps gamma ramps near the identity.

Functions

func SizeLabel

func SizeLabel(w, h int) string

SizeLabel names a resolution the way monitors are sold: "4K", "2K".

Types

type Mode

type Mode struct {
	Width, Height           int // the size the desktop uses (points on macOS)
	PixelWidth, PixelHeight int // the size drawn
	RefreshRate             int
	// contains filtered or unexported fields
}

Mode is a resolution and refresh rate the monitor can show.

func RefreshRates

func RefreshRates(modes []Mode, current Mode) []Mode

RefreshRates returns the modes of the resolution of current, fastest first.

func Resolutions

func Resolutions(modes []Mode, hiDPI bool, refreshRate int) []Mode

Resolutions returns one mode per resolution, HiDPI or not, preferring the given refresh rate, from the largest.

func (Mode) HiDPI

func (m Mode) HiDPI() bool

func (Mode) ID

func (m Mode) ID() string

func (Mode) SizeKey

func (m Mode) SizeKey() string

SizeKey identifies the resolution, whatever the refresh rate.

func (Mode) Title

func (m Mode) Title() string

type Monitor

type Monitor struct {
	Name       string // e.g. "Mi Monitor"
	Connection string // e.g. "HDMI", or "" when unknown
	// Native is the panel's own resolution where the system tells it
	// (Windows, from the EDID), zero otherwise.
	NativeWidth, NativeHeight int
	// contains filtered or unexported fields
}

Monitor is the external display the app manages.

func (Monitor) NativeSize

func (m Monitor) NativeSize(modes []Mode, current Mode) (w, h int)

NativeSize is the monitor's own resolution: what the system reports, or the largest mode drawn 1:1, as HiDPI modes draw more pixels than the panel has. A reported size smaller than the current mode is not trusted (virtual displays of remote desktops report one): the current mode wins.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL