display

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: Apache-2.0, BSD-3-Clause, MIT Imports: 3 Imported by: 0

Documentation

Overview

Package display provides display environment detection for all binaries Per AI.md PART 7: BINARY REQUIREMENTS - Display Environment Detection

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DisplayType

type DisplayType string

DisplayType represents the type of display available

const (
	DisplayTypeNone    DisplayType = "none"
	DisplayTypeX11     DisplayType = "x11"
	DisplayTypeWayland DisplayType = "wayland"
	DisplayTypeWindows DisplayType = "windows"
	DisplayTypeMacOS   DisplayType = "macos"
)

type Env

type Env struct {
	// Display availability
	HasDisplay  bool        // X11, Wayland, Windows, macOS display available
	DisplayType DisplayType // Type of display: x11, wayland, windows, macos, none

	// Terminal state
	IsTerminal bool // stdout is a TTY
	Cols       int  // Terminal columns (0 if no terminal)
	Rows       int  // Terminal rows (0 if no terminal)

	// Remote session detection
	IsSSH    bool // Running over SSH
	IsMosh   bool // Running over mosh
	IsScreen bool // Running in GNU screen
	IsTmux   bool // Running in tmux

	// Environment
	OS       string // Runtime OS (linux, darwin, windows, freebsd, etc.)
	HasColor bool   // Terminal supports colors
}

Env represents the detected display environment

func Detect

func Detect() Env

Detect detects the current display environment

func (Env) GetMode

func (e Env) GetMode() Mode

GetMode determines the appropriate display mode based on environment

func (Env) IsMultiplexed

func (e Env) IsMultiplexed() bool

IsMultiplexed returns true if running in a terminal multiplexer

func (Env) IsRemote

func (e Env) IsRemote() bool

IsRemote returns true if running in a remote session

func (Env) TerminalSize

func (e Env) TerminalSize() (cols, rows int)

TerminalSize returns the terminal size or default values

type Mode

type Mode int

Mode represents the display mode of the application

const (
	// ModeHeadless - No display, no TTY (daemon, service, cron)
	ModeHeadless Mode = iota
	// ModeCLI - Command provided or piped output
	ModeCLI
	// ModeTUI - Terminal available, interactive (TTY, SSH, mosh, screen, tmux)
	ModeTUI
	// ModeGUI - Native display available (X11, Wayland, Windows, macOS)
	ModeGUI
)

func (Mode) IsDaemon

func (m Mode) IsDaemon() bool

IsDaemon returns true if running as daemon/service

func (Mode) IsInteractive

func (m Mode) IsInteractive() bool

IsInteractive returns true if running interactively

func (Mode) String

func (m Mode) String() string

String returns the string representation of the mode

func (Mode) SupportsColors

func (m Mode) SupportsColors() bool

SupportsColors returns true if the mode supports colored output

func (Mode) SupportsInteraction

func (m Mode) SupportsInteraction() bool

SupportsInteraction returns true if the mode supports user interaction

func (Mode) SupportsRichOutput

func (m Mode) SupportsRichOutput() bool

SupportsRichOutput returns true if the mode supports rich formatted output

Jump to

Keyboard shortcuts

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