Documentation
¶
Overview ¶
Package wslg discovers an explicitly selected WSL user's display connection values. It never imports a shell environment or grants access to GUI sockets.
Index ¶
- Constants
- Variables
- func CheckCollisions(source string, env []string, windows bool) error
- func CheckEnvironmentSources(sources map[string][]string, windows bool) error
- func Overlay(base []string, env map[string]string, windows bool) []string
- func Pairs(env map[string]string) []string
- func Reserved(key string, windows bool) bool
- func ValidateEnvironment(env map[string]string) error
- func ValidateTarget(target Target) error
- type ProbeResult
- type Runner
- type Snapshot
- type Target
Constants ¶
const ( Display = "DEVSY_WSLG_DISPLAY" WaylandDisplay = "DEVSY_WSLG_WAYLAND_DISPLAY" RuntimeDir = "DEVSY_WSLG_XDG_RUNTIME_DIR" )
Variables ¶
var ( ErrUnsupported = errors.New( "WSLg discovery requires native Windows and a local Docker runtime", ) ErrInvalidTarget = errors.New("WSLg discovery requires an explicit non-root WSL distro/user") ErrExecutable = errors.New("WSLg discovery cannot locate the Windows system wsl.exe") ErrProtocol = errors.New( "WSLg probe failed; verify the selected distro/user and /usr/bin/printenv", ) "WSLg has no usable DISPLAY or WAYLAND_DISPLAY for the selected user; " + "check that the distribution is running and WSLg is enabled", ) ErrCollision = errors.New("reserved WSLg environment assignment") )
Functions ¶
func CheckEnvironmentSources ¶
CheckEnvironmentSources rejects assignments before provider construction can log its effective environment or start a runtime.
func Overlay ¶
Overlay replaces the reserved entries, including Windows case variants, once. Ordinary environment precedence remains the caller's responsibility.
func ValidateEnvironment ¶
func ValidateTarget ¶
Types ¶
type ProbeResult ¶
type Snapshot ¶
type Snapshot struct {
// contains filtered or unexported fields
}
Snapshot contains only present keys; an empty string is distinct from absence. Accessors return copies so an invocation cannot mutate another's environment.
func Capture ¶
Capture exposes the bounded probe for tests; production always resolves the trusted executable using the Windows system API in Discover.