screen

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 3 Imported by: ? 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 screen lists the displays attached to the computer.

Coordinates are logical (DIP) pixels with the origin at the top-left corner of the primary display; displays left of or above it have negative coordinates. Scale is the ratio of physical to logical pixels.

Functions are safe from any goroutine once the app runs. They return ErrUnsupported when the backend cannot list displays (mobile, minimal backends) and tango.ErrNotRunning after the app quit. Display changes (a monitor plugged in, the arrangement or scale changed) arrive as tango.EventDisplaysChanged; OnChange is a shortcut for listening to them.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoDisplay = errors.New("tango: no display")

ErrNoDisplay is returned when the system reports no display at all (a headless session).

View Source
var ErrUnsupported = platform.ErrUnsupported

ErrUnsupported is platform.ErrUnsupported, re-exported for callers outside the module.

Functions

func OnChange

func OnChange(a *tango.App, fn func())

OnChange calls fn on the main thread whenever displays are added, removed, rearranged or rescaled.

Types

type Display

type Display = platform.Display

Display is one monitor. WorkArea excludes the menu bar, dock and taskbars.

func All

func All(a *tango.App) ([]Display, error)

All returns every display; the primary one is first.

func At

func At(a *tango.App, x, y int) (Display, error)

At returns the display containing the point (x, y), or the display nearest to it when the point is on none.

func Primary

func Primary(a *tango.App) (Display, error)

Primary returns the primary display (the one with the menu bar on macOS, the main taskbar on Windows).

type Rect

type Rect = platform.Rect

Rect is a rectangle in logical pixels.

Jump to

Keyboard shortcuts

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