monitor

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: MIT Imports: 8 Imported by: 0

README

devices-monitor

Connected display information for the devices-* family: EDID identity as static values, live modes as dynamic ones. Windows + Linux, no cgo required.

basic detailed full
static vendor, model name, native resolution, diagonal product code, manufacture date, physical size serial number
dynamic current resolution, refresh, color depth, primary (Windows); connected/enabled (Linux)

Both platforms hand over the same artifact — the display's 128-byte EDID block — so one parser serves both: Linux reads it from /sys/class/drm, Windows lists active monitors via WMI and reads each EDID from the PnP registry. Live modes come from user32 display syscalls on Windows; on Linux they need a display-server query (xrandr/wayland), reported as a gap until that lands.

$ devices-monitor
$ devices-monitor --level full --json
$ devices-monitor web :8080

MIT — see LICENSE.

Documentation

Overview

Package monitor reports connected display information for the jarvisfriends devices-* family: EDID identity (make, model, size, native resolution, serial) as static values, and the live mode (resolution, refresh rate) as dynamic ones. Works without cgo on Windows and Linux.

Both platforms ultimately hand over the same artifact — the display's 128-byte EDID block — so one parser (edid.go) serves both. Linux reads it from /sys/class/drm; Windows lists active monitors via WMI and reads each EDID from the PnP registry. Live modes come from user32 display syscalls on Windows; on Linux they need a display-server query, reported as a gap until that lands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

type Collector struct{}

Collector implements devices.Collector for the monitor category.

func New

func New() *Collector

New builds the monitor collector.

func (*Collector) Category

func (*Collector) Category() string

Category satisfies devices.Collector.

func (*Collector) Dynamic

func (*Collector) Dynamic(ctx context.Context, level devices.Level) (devices.Snapshot, error)

Dynamic satisfies devices.Collector.

func (*Collector) Static

func (*Collector) Static(ctx context.Context, level devices.Level) (devices.Snapshot, error)

Static satisfies devices.Collector.

type EDID

type EDID struct {
	// Manufacturer is the three-letter PNP vendor code ("DEL", "GSM", "SAM").
	Manufacturer string
	ProductCode  uint16
	SerialNumber uint32
	// SerialString is the serial from the descriptor block, when present —
	// usually the one printed on the label.
	SerialString string
	// Name is the model name descriptor ("DELL U2723QE").
	Name string
	Year int
	Week int
	// WidthCm and HeightCm are the physical image size.
	WidthCm  int
	HeightCm int
	// PreferredWidth and PreferredHeight are the native mode's pixels.
	PreferredWidth  int
	PreferredHeight int
}

EDID is the decoded identity block a display reports about itself. Both platforms hand us the same 128-byte base block — Linux via /sys/class/drm/*/edid, Windows via the PnP registry — so one parser covers them. (No maintained Go EDID library exists; the format is a fixed, well-documented 128-byte structure, which makes this the rare case where writing it ourselves beats vendoring an abandoned one.)

func ParseEDID

func ParseEDID(b []byte) (*EDID, error)

ParseEDID decodes the 128-byte EDID base block. Extension blocks carry audio/HDR/colorimetry details this category doesn't report, so they are ignored.

func (*EDID) DiagonalInches

func (e *EDID) DiagonalInches() float64

DiagonalInches computes the physical diagonal from the EDID image size, zero when the display didn't report one (projectors, some laptop panels).

Directories

Path Synopsis
cmd
devices-monitor command
Command devices-monitor reports connected display identity and live modes using the shared devices-common CLI: one-shot, --json, --tui, --web.
Command devices-monitor reports connected display identity and live modes using the shared devices-common CLI: one-shot, --json, --tui, --web.

Jump to

Keyboard shortcuts

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