Documentation
¶
Overview ¶
Package port defines the interfaces implemented by detection adapters.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bus ¶
type Bus interface {
// HasOwner reports whether a well-known name currently has an owner.
HasOwner(ctx context.Context, k BusKind, name string) (bool, error)
// Introspect returns the raw introspection XML for an object path.
Introspect(ctx context.Context, k BusKind, object *Object) (string, error)
// Property reads a single property off an interface.
Property(ctx context.Context, k BusKind, query *PropertyQuery) (PropertyValue, error)
// Properties reads every property on an interface in one round trip.
Properties(ctx context.Context, k BusKind, query *PropertyQuery) (map[string]any, error)
// Close releases any connections that were opened.
Close() error
}
Bus is the D-Bus port. It is deliberately narrow: the library only ever needs to ask whether a name is claimed, list the interfaces on an object, and read a property.
type BusKind ¶
type BusKind uint8
BusKind selects one of the two D-Bus instances a desktop session has.
type DesktopProbe ¶
type DesktopProbe interface {
Desktop(ctx context.Context, environment *domain.Env) (domain.DesktopInfo, error)
}
DesktopProbe identifies the desktop environment and, where it is cheap to obtain, its version.
type EnvProbe ¶
EnvProbe snapshots the process environment. It is the one probe that never fails and never blocks, so it runs synchronously before everything else.
type GPUProbe ¶
GPUProbe enumerates the machine's GPUs and names the primary one. It is separate from StackProbe because the two answer genuinely different questions from unrelated sources: what hardware is present, and what the client-side driver stack can do with it.
type Object ¶
type Object struct {
// Destination is the bus name that owns the object.
Destination string
// Path is the D-Bus object path.
Path string
}
Object identifies a destination and object path on a selected bus.
type PortalProbe ¶
type PortalProbe interface {
Portal(ctx context.Context, environment *domain.Env) (domain.PortalInfo, error)
}
PortalProbe inspects xdg-desktop-portal.
type ProcessProbe ¶
ProcessProbe lists the command names of the calling user's processes. It is the last-resort signal for compositor detection and is only invoked when explicitly enabled.
type PropertyAddress ¶
type PropertyAddress = struct {
// Destination is the bus name that owns the object.
Destination string
// Path is the D-Bus object path.
Path string
// Interface identifies the interface containing the property.
Interface string
// Name identifies the property; empty when reading the entire interface.
Name string
}
PropertyAddress is the structural address of a property request.
type PropertyQuery ¶
type PropertyQuery struct {
// Object identifies the destination and object path.
Object Object
// Interface is the D-Bus interface containing the property.
Interface string
// Name is the property name; empty when reading all properties.
Name string
}
PropertyQuery identifies an interface and optional property on a bus object.
func (*PropertyQuery) PropertyAddress ¶
func (query *PropertyQuery) PropertyAddress() PropertyAddress
PropertyAddress returns the complete address used to read one or all properties.
type PropertyValue ¶
type PropertyValue = struct {
// Value is the decoded property payload.
Value any
}
PropertyValue carries the heterogeneous payload of a D-Bus property.
type SessionProbe ¶
type SessionProbe interface {
Session(ctx context.Context, environment *domain.Env) (domain.SessionInfo, error)
}
SessionProbe reads the logind seat session.
type StackProbe ¶
type StackProbe interface {
Stack(ctx context.Context) (domain.OpenGLInfo, domain.VulkanInfo, error)
}
StackProbe reports the OpenGL and Vulkan implementations.
type WaylandProbe ¶
WaylandProbe connects to the compositor and enumerates its global registry. A nil result with a nil error means there was no compositor to talk to.