Documentation
¶
Overview ¶
Package domain defines internal detection models and enumerations. Internal values use structural aliases; linuxdesktop owns the nominal public types.
Index ¶
- Constants
- type CompositorInfo
- type CompositorKind
- type DesktopEnvironment
- type DesktopInfo
- type DetectionConfidence
- type DetectionMethod
- type DisplayInfo
- type DisplayProtocol
- type Env
- type Environment
- type GPUInfo
- type GraphicsInfo
- type OSInfo
- type OpenGLInfo
- type PortalInfo
- type Section
- type SessionInfo
- type SessionType
- type Signals
- type VulkanInfo
- type WaylandGlobal
- type WaylandInfo
- type X11Info
Constants ¶
const ( // SectionOS selects operating system information. Combine the section flags // with bitwise OR to select multiple parts of an Environment. SectionOS Section = 1 << iota // SectionSession selects login session information. SectionSession // SectionDisplay selects display server information. SectionDisplay // SectionDesktop selects desktop environment information. SectionDesktop // SectionCompositor selects compositor identification. SectionCompositor // SectionGraphics selects GPU and graphics stack information. SectionGraphics // SectionPortal selects desktop portal information. SectionPortal // SectionAll selects every section and is the default. SectionAll Section = SectionOS | SectionSession | SectionDisplay | SectionDesktop | SectionCompositor | SectionGraphics | SectionPortal // Unknown indicates an unidentified session, display, desktop, compositor, // confidence, or detection method. It is assignable to each identity type. Unknown = "unknown" // SessionTypeWayland and the other session constants mirror logind's TYPE= // and $XDG_SESSION_TYPE. SessionTypeWayland SessionType = "wayland" SessionTypeX11 SessionType = "x11" SessionTypeTTY SessionType = "tty" SessionTypeMir SessionType = "mir" // DesktopGNOME and the other desktop constants identify recognized environments. DesktopGNOME DesktopEnvironment = "gnome" DesktopKDE DesktopEnvironment = "kde" DesktopXFCE DesktopEnvironment = "xfce" DesktopCinnamon DesktopEnvironment = "cinnamon" DesktopMATE DesktopEnvironment = "mate" DesktopLXQt DesktopEnvironment = "lxqt" DesktopLXDE DesktopEnvironment = "lxde" DesktopBudgie DesktopEnvironment = "budgie" DesktopCOSMIC DesktopEnvironment = "cosmic" DesktopPantheon DesktopEnvironment = "pantheon" // CompositorMutter and the other compositor constants identify recognized // compositors or window managers. For Unknown, CompositorInfo.Name preserves // the unrecognized raw name. CompositorMutter CompositorKind = "mutter" CompositorKWin CompositorKind = "kwin" CompositorSway CompositorKind = "sway" CompositorHyprland CompositorKind = "hyprland" CompositorWayfire CompositorKind = "wayfire" CompositorRiver CompositorKind = "river" CompositorWeston CompositorKind = "weston" CompositorLabwc CompositorKind = "labwc" CompositorXfwm CompositorKind = "xfwm4" CompositorMarco CompositorKind = "marco" CompositorOpenbox CompositorKind = "openbox" CompositorI3 CompositorKind = "i3" CompositorAwesome CompositorKind = "awesome" // ConfidenceLow and the other confidence constants grade detection evidence. ConfidenceLow DetectionConfidence = "low" ConfidenceMedium DetectionConfidence = "medium" ConfidenceHigh DetectionConfidence = "high" // DetectedEnvironment and the other detection methods are roughly ordered // from cheapest to most invasive. DetectedEnvironment DetectionMethod = "environment" DetectedLogind DetectionMethod = "logind" DetectedDBus DetectionMethod = "dbus" DetectedX11EWMH DetectionMethod = "x11_ewmh" DetectedWayland DetectionMethod = "wayland_protocol" DetectedSocket DetectionMethod = "socket" DetectedProcess DetectionMethod = "process" // ExtensionXWayland is the X11 extension an Xwayland server advertises and a // native X.Org server does not. Its presence in X11Info.Extensions is the only // unambiguous way to tell the two apart. ExtensionXWayland = "XWAYLAND" )
Detection flags and identities describe the selected sections and recognized desktop components.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompositorInfo ¶
type CompositorInfo = schema.CompositorInfo[CompositorKind, DetectionConfidence, DetectionMethod]
CompositorInfo identifies the compositor or window manager, and says how certain that identification is.
type CompositorKind ¶
type CompositorKind = string
CompositorKind is a recognized window manager or Wayland compositor.
type DesktopEnvironment ¶
type DesktopEnvironment = string
DesktopEnvironment is a recognized desktop environment.
type DesktopInfo ¶
type DesktopInfo = schema.DesktopInfo[DesktopEnvironment]
DesktopInfo identifies the desktop environment.
type DetectionConfidence ¶
type DetectionConfidence = string
DetectionConfidence grades how much a detection result can be trusted.
type DetectionMethod ¶
type DetectionMethod = string
DetectionMethod records which signal produced a detection result.
type DisplayInfo ¶
type DisplayInfo = schema.DisplayInfo[X11Info, WaylandInfo, DisplayProtocol]
DisplayInfo describes which display servers are reachable.
type DisplayProtocol ¶
type DisplayProtocol = string
DisplayProtocol is the windowing protocol the process should speak.
type Env ¶
type Env = struct {
// SessionID unmodified XDG_SESSION_ID value.
SessionID string
// SessionType unmodified XDG_SESSION_TYPE value.
SessionType string
// SessionDesktop unmodified XDG_SESSION_DESKTOP value.
SessionDesktop string
// SessionClass unmodified XDG_SESSION_CLASS value.
SessionClass string
// CurrentDesktop unmodified XDG_CURRENT_DESKTOP value.
CurrentDesktop string
// DesktopSession unmodified DESKTOP_SESSION value.
DesktopSession string
// WaylandDisplay wayland socket name from WAYLAND_DISPLAY.
WaylandDisplay string
// WaylandSocket unmodified WAYLAND_SOCKET descriptor value.
WaylandSocket string
// Display unmodified DISPLAY value.
Display string
// RuntimeDir unmodified XDG_RUNTIME_DIR value.
RuntimeDir string
// ConfigHome unmodified XDG_CONFIG_HOME value.
ConfigHome string
// Home unmodified HOME value.
Home string
// User uSER value, falling back to LOGNAME.
User string
// Seat unmodified XDG_SEAT value.
Seat string
// VTNR unmodified XDG_VTNR value.
VTNR string
// HyprlandSignature unmodified HYPRLAND_INSTANCE_SIGNATURE value.
HyprlandSignature string
// SwaySock unmodified SWAYSOCK value.
SwaySock string
// WayfireSocket unmodified WAYFIRE_SOCKET value.
WayfireSocket string
// I3Sock unmodified I3SOCK value.
I3Sock string
// KDEFullSession unmodified KDE_FULL_SESSION marker.
KDEFullSession string
// KDESessionVersion unmodified KDE_SESSION_VERSION value.
KDESessionVersion string
// GNOMESessionID unmodified GNOME_DESKTOP_SESSION_ID marker.
GNOMESessionID string
// GNOMESetupDisplay unmodified GNOME_SETUP_DISPLAY value.
GNOMESetupDisplay string
// SSHConnection unmodified SSH_CONNECTION value.
SSHConnection string
// SSHTTY unmodified SSH_TTY value.
SSHTTY string
// SSHClient unmodified SSH_CLIENT value.
SSHClient string
}
Env is every environment variable the library will ever consult, read once at the start of a detection run so no probe pays for a repeated lookup.
type Environment ¶
type Environment = schema.Environment[ OSInfo, SessionInfo, DisplayInfo, DesktopInfo, CompositorInfo, GraphicsInfo, PortalInfo, ]
Environment is the complete picture of the desktop the process is running in.
type GPUInfo ¶
type GPUInfo = struct {
// ID identifier reported by the underlying system.
ID string `json:"id"`
// Vendor vendor name reported by the driver or server.
Vendor string `json:"vendor"`
// Model marketing name from the driver or PCI device database.
Model string `json:"model"`
// VendorID pCI vendor identifier as reported by sysfs.
VendorID string `json:"vendor_id"`
// DeviceID pCI device identifier as reported by sysfs.
DeviceID string `json:"device_id"`
// PCIAddress pCI slot address, when the GPU is on a PCI bus.
PCIAddress string `json:"pci_address"`
// Driver kernel driver bound to the device.
Driver string `json:"driver"`
// DRMDevice path to the DRM card device.
DRMDevice string `json:"drm_device"`
// RenderDevice path to the corresponding DRM render node.
RenderDevice string `json:"render_device"`
// Integrated whether the device is classified as integrated.
Integrated bool `json:"integrated"`
// Discrete whether the device is classified as discrete.
Discrete bool `json:"discrete"`
}
GPUInfo is one DRM device and its PCI identity.
type GraphicsInfo ¶
type GraphicsInfo = schema.GraphicsInfo[OpenGLInfo, VulkanInfo, GPUInfo]
GraphicsInfo describes the GPUs and the client-side graphics stack.
type OSInfo ¶
type OSInfo = struct {
// Name human-readable name reported by the source.
Name string `json:"name"`
// PrettyName human-readable distribution name from os-release.
PrettyName string `json:"pretty_name"`
// ID identifier reported by the underlying system.
ID string `json:"id"`
// IDLike related distribution identifiers from os-release.
IDLike string `json:"id_like"`
// Version version reported by the source, when available.
Version string `json:"version"`
// VersionID machine-readable distribution version.
VersionID string `json:"version_id"`
// Kernel kernel name.
Kernel string `json:"kernel"`
// KernelRelease kernel release string.
KernelRelease string `json:"kernel_release"`
// Architecture architecture in uname-style spelling.
Architecture string `json:"architecture"`
// Hostname host name reported by the operating system.
Hostname string `json:"hostname"`
}
OSInfo describes the operating system and kernel.
type OpenGLInfo ¶
type OpenGLInfo = struct {
// Vendor vendor name reported by the driver or server.
Vendor string `json:"vendor,omitempty"`
// Renderer openGL renderer string from the live driver.
Renderer string `json:"renderer,omitempty"`
// Version version reported by the source, when available.
Version string `json:"version,omitempty"`
// Available whether the implementation or service was detected.
Available bool `json:"available"`
}
OpenGLInfo describes the OpenGL implementation.
type PortalInfo ¶
type PortalInfo = struct {
// Backend preferred or matching portal implementation.
Backend string `json:"backend,omitempty"`
// Available whether the implementation or service was detected.
Available bool `json:"available"`
// DesktopPortal whether any desktop portal interface is exported.
DesktopPortal bool `json:"desktop_portal"`
// ScreenCast whether the ScreenCast interface is exported.
ScreenCast bool `json:"screencast"`
// Screenshot whether the Screenshot interface is exported.
Screenshot bool `json:"screenshot"`
// FileChooser whether the FileChooser interface is exported.
FileChooser bool `json:"file_chooser"`
// OpenURI whether the OpenURI interface is exported.
OpenURI bool `json:"open_uri"`
// RemoteDesktop whether the RemoteDesktop interface is exported.
RemoteDesktop bool `json:"remote_desktop"`
// Inhibit whether the Inhibit interface is exported.
Inhibit bool `json:"inhibit"`
// Notification whether the Notification interface is exported.
Notification bool `json:"notification"`
}
PortalInfo describes xdg-desktop-portal and which of its interfaces the running backend actually exports.
type Section ¶
type Section = uint16
Section selects which parts of an Environment to populate. Sections are a bitmask so a caller can pay only for what it reads.
type SessionInfo ¶
type SessionInfo = schema.SessionInfo[SessionType]
SessionInfo describes the logind seat session.
type SessionType ¶
type SessionType = string
SessionType is the kind of seat session the process is attached to.
type Signals ¶
type Signals = evidence[Env, DesktopEnvironment, WaylandGlobal]
Signals carries the raw evidence classification rules reason over. It is filled by the protocol adapters in stage one and consumed by package rules in stage two.
type VulkanInfo ¶
type VulkanInfo = struct {
// Version version reported by the source, when available.
Version string `json:"version,omitempty"`
// Available whether the implementation or service was detected.
Available bool `json:"available"`
}
VulkanInfo describes the Vulkan loader and its ICDs.
type WaylandGlobal ¶
type WaylandGlobal = struct {
// Interface fully qualified Wayland interface name.
Interface string `json:"interface"`
// Name numeric object name assigned by the Wayland registry.
Name uint32 `json:"name"`
// Version version reported by the source, when available.
Version uint32 `json:"version"`
}
WaylandGlobal is one entry from the compositor's global registry.
type WaylandInfo ¶
type WaylandInfo = schema.WaylandInfo[WaylandGlobal]
WaylandInfo is the result of a real connection to a Wayland compositor.
type X11Info ¶
type X11Info = struct {
// Display x display address used for the connection.
Display string `json:"display"`
// Vendor vendor name reported by the driver or server.
Vendor string `json:"vendor"`
// WindowManager window manager name from EWMH properties.
WindowManager string `json:"window_manager"`
// Extensions extension names advertised by the X server.
Extensions []string `json:"extensions,omitempty"`
// Screen default X screen index.
Screen int `json:"screen"`
// ProtocolMajor major version of the X protocol.
ProtocolMajor int `json:"protocol_major"`
// ProtocolMinor minor version of the X protocol.
ProtocolMinor int `json:"protocol_minor"`
}
X11Info is the result of a real connection to an X server.