display

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package display handles monitor detection and cursor tracking

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	GetMonitors() ([]*Monitor, error)
	GetCursorPosition() (x, y int32, err error)
	Close() error
}

Backend interface for different display detection methods

type Display

type Display struct {
	// contains filtered or unexported fields
}

Display manages monitor configuration and cursor tracking

func New

func New() (*Display, error)

New creates a new display manager

func (*Display) Close

func (d *Display) Close() error

Close cleans up resources

func (*Display) GetCursorPosition

func (d *Display) GetCursorPosition() (x, y int32, monitor *Monitor, err error)

GetCursorPosition returns the current cursor position

func (*Display) GetEdge

func (d *Display) GetEdge(x, y int32, threshold int32) Edge

GetEdge determines which edge the cursor is near

func (*Display) GetMonitorAt

func (d *Display) GetMonitorAt(x, y int32) *Monitor

GetMonitorAt returns the monitor containing the given coordinates

func (*Display) GetMonitors

func (d *Display) GetMonitors() []*Monitor

GetMonitors returns all detected monitors

func (*Display) GetPrimaryMonitor

func (d *Display) GetPrimaryMonitor() *Monitor

GetPrimaryMonitor returns the primary monitor

type Edge

type Edge int

Edge represents screen edges

const (
	EdgeNone Edge = iota
	EdgeLeft
	EdgeRight
	EdgeTop
	EdgeBottom
)

func (Edge) String

func (e Edge) String() string

type Monitor

type Monitor struct {
	ID      string
	Name    string
	X       int32 // Position in global coordinate space
	Y       int32
	Width   int32
	Height  int32
	Primary bool
	Scale   float64
}

Monitor represents a physical display

func (*Monitor) Bounds

func (m *Monitor) Bounds() (x1, y1, x2, y2 int32)

Bounds returns the monitor's boundaries

func (*Monitor) Contains

func (m *Monitor) Contains(x, y int32) bool

Contains checks if a point is within this monitor

Jump to

Keyboard shortcuts

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