session

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT, MIT Imports: 32 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package session gives lys-wm its seat: devices through logind, VT switching, and device discovery.

Index

Constants

View Source
const (
	MinAccelPoints = 2
	MaxAccelPoints = 64
	MaxAccelStep   = 10000
	MaxAccelPoint  = 10000
)
View Source
const (
	DefaultSeat = "seat0"
)
View Source
const (
	HolderProtocol = 2
)
View Source
const LibinputEnv = "LYS_WM_LIBINPUT"

Variables

View Source
var (
	AccelFlat     = AccelProfile{/* contains filtered or unexported fields */}
	AccelAdaptive = AccelProfile{/* contains filtered or unexported fields */}
	AccelProfiles = []AccelProfile{AccelFlat, AccelAdaptive}
)
View Source
var ErrDeclined = errors.New("libinput does not handle the device")
View Source
var SystemRoots = Roots{Sys: "/sys", UdevData: "/run/udev/data"}

Functions

func LibinputPath

func LibinputPath(getenv func(string) string) string

func OnBattery

func OnBattery(roots Roots) (bool, error)

func SendHolder

func SendHolder(fd int, m HolderMsg, fds ...int) error

func SystemBus

func SystemBus(getenv func(string) string) string

Types

type AccelProfile

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

func AccelCustom

func AccelCustom(step float64, points []float64) (AccelProfile, error)

func (AccelProfile) String

func (p AccelProfile) String() string

type Action

type Action string
const (
	Add      Action = "add"
	Remove   Action = "remove"
	Change   Action = "change"
	Overflow Action = "overflow"
)

type Area

type Area struct {
	X1, Y1, X2, Y2 float64
}

func NewArea

func NewArea(x, y, w, h float64) (Area, error)

type Calibration

type Calibration [6]float32

func NewCalibration

func NewCalibration(m [6]float64) (Calibration, error)

type ClassConfig

type ClassConfig struct {
	DeviceConfig
	AccelProfile AccelProfile
}

type ClickMethod

type ClickMethod uint32
const (
	ClickNone        ClickMethod = 0
	ClickButtonAreas ClickMethod = 1 << 0
	ClickFinger      ClickMethod = 1 << 1
)

type Device

type Device = logind.Device

func DeviceOf

func DeviceOf(path string) (Device, error)

type DeviceClass

type DeviceClass uint8
const (
	ClassPointer DeviceClass = iota
	ClassTouchpad
	ClassTrackpoint
)

func DeviceClasses

func DeviceClasses() []DeviceClass

func (DeviceClass) DefaultAccel

func (c DeviceClass) DefaultAccel() AccelProfile

func (DeviceClass) String

func (c DeviceClass) String() string

type DeviceConfig

type DeviceConfig struct {
	Tap, DragLock, NaturalScroll, DisableWhileTyping, MiddleEmulation *bool
	LeftHanded, ScrollButtonLock, DisabledOnExternalMouse             *bool
	ClickMethod                                                       *ClickMethod
	ScrollMethod                                                      *ScrollMethod
	ScrollButton                                                      *uint32
	TapButtonMap                                                      *TapButtonMap
	AccelSpeed, ScrollFactor                                          *float64
}

type Holder

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

func DialHolder

func DialHolder(fd int, l *loop.Loop) (*Holder, error)

func (*Holder) Active

func (h *Holder) Active() bool

func (*Holder) Close

func (h *Holder) Close() error

func (*Holder) Commit

func (h *Holder) Commit() error

func (*Holder) InhibitLidSwitch

func (h *Holder) InhibitLidSwitch() (*os.File, error)

func (*Holder) LidClosed

func (h *Holder) LidClosed() (bool, error)

func (*Holder) OnExit

func (h *Holder) OnExit(pid int, f func())

func (*Holder) Open

func (h *Holder) Open(listener Listener) error

func (*Holder) ReleaseDevice

func (h *Holder) ReleaseDevice(d Device) error

func (*Holder) Seat

func (h *Holder) Seat() string

func (*Holder) Spawn

func (h *Holder) Spawn(binary string, args []string, handover, stderr int) (int, error)

func (*Holder) Suspend

func (h *Holder) Suspend() error

func (*Holder) SwitchTo

func (h *Holder) SwitchTo(vt uint32) error

func (*Holder) TakeDevice

func (h *Holder) TakeDevice(path string) (int, Device, error)

type HolderMsg

type HolderMsg struct {
	Op       HolderOp `json:"op"`
	ID       uint64   `json:"id,omitempty"`
	Path     string   `json:"path,omitempty"`
	Binary   string   `json:"binary,omitempty"`
	Args     []string `json:"args,omitempty"`
	Major    uint32   `json:"major,omitempty"`
	Minor    uint32   `json:"minor,omitempty"`
	VT       uint32   `json:"vt,omitempty"`
	Seat     string   `json:"seat,omitempty"`
	On       bool     `json:"on,omitempty"`
	PID      int      `json:"pid,omitempty"`
	Protocol int      `json:"protocol,omitempty"`
	Err      string   `json:"err,omitempty"`
}

func RecvHolder

func RecvHolder(fd int) (HolderMsg, []int, error)

type HolderOp

type HolderOp string
const (
	OpHello     HolderOp = "hello"
	OpOpen      HolderOp = "open"
	OpTake      HolderOp = "take"
	OpRelease   HolderOp = "release"
	OpInhibit   HolderOp = "inhibit"
	OpLid       HolderOp = "lid"
	OpSuspend   HolderOp = "suspend"
	OpSwitchTo  HolderOp = "switch"
	OpSpawn     HolderOp = "spawn"
	OpCommit    HolderOp = "commit"
	OpPauseDone HolderOp = "pausedone"
	OpPaused    HolderOp = "paused"
	OpResumed   HolderOp = "resumed"
	OpActive    HolderOp = "active"
	OpSleep     HolderOp = "sleep"
	OpReply     HolderOp = "reply"
	OpExited    HolderOp = "exited"
)

type InputConfig

type InputConfig struct {
	Classes [len(deviceClassNames)]ClassConfig
	Devices map[string]NamedDeviceConfig
}

func DefaultInputConfig

func DefaultInputConfig() InputConfig

type InputDevice

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

func (*InputDevice) Capabilities

func (d *InputDevice) Capabilities() backend.Capability

func (*InputDevice) Group

func (d *InputDevice) Group() uintptr

func (*InputDevice) Name

func (d *InputDevice) Name() string

func (*InputDevice) Pad

func (d *InputDevice) Pad() (tabletinput.PadLayout, bool)

func (*InputDevice) SetLEDs

func (d *InputDevice) SetLEDs(l xkb.Locks)

func (*InputDevice) Tablet

func (d *InputDevice) Tablet() (tabletinput.ID, bool)

type Libinput

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

func OpenLibinput

func OpenLibinput(l *loop.Loop, path string, opener Opener, config InputConfig, report func(error), raise RaisePriority) (*Libinput, error)

func (*Libinput) AddLater

func (in *Libinput) AddLater(path string)

func (*Libinput) Close

func (in *Libinput) Close() error

func (*Libinput) Park

func (in *Libinput) Park() error

func (*Libinput) Reconfigure

func (in *Libinput) Reconfigure(config InputConfig) error

func (*Libinput) Remove

func (in *Libinput) Remove(path string)

func (*Libinput) ResumeLater

func (in *Libinput) ResumeLater()

func (*Libinput) Start

func (in *Libinput) Start(h backend.Handler)

func (*Libinput) Suspend

func (in *Libinput) Suspend()

func (*Libinput) Unpark

func (in *Libinput) Unpark() error

type Listener

type Listener interface {
	DevicePaused(d Device) error
	DeviceResumed(d Device, fd int) error
	ActiveChanged(active bool) error
	PrepareForSleep(sleeping bool) error
}

type Logind

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

func Open

func Open(l *loop.Loop, address string, getenv func(string) string, listener Listener) (lg *Logind, err error)

func (*Logind) Active

func (lg *Logind) Active() bool

func (*Logind) Close

func (lg *Logind) Close() error

func (*Logind) CompletePause

func (lg *Logind) CompletePause(d Device) error

func (*Logind) DeferPauses

func (lg *Logind) DeferPauses()

func (*Logind) InhibitLidSwitch

func (lg *Logind) InhibitLidSwitch() (*os.File, error)

func (*Logind) LidClosed

func (lg *Logind) LidClosed() (bool, error)

func (*Logind) ReleaseDevice

func (lg *Logind) ReleaseDevice(d Device) error

func (*Logind) Seat

func (lg *Logind) Seat() string

func (*Logind) Suspend

func (lg *Logind) Suspend() error

func (*Logind) SwitchTo

func (lg *Logind) SwitchTo(vt uint32) error

func (*Logind) TakeDevice

func (lg *Logind) TakeDevice(path string) (int, Device, error)

type Monitor

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

func Watch

func Watch(l *loop.Loop, seat string, subsystems []Subsystem, handle func(UdevEvent) error) (*Monitor, error)

func (*Monitor) Close

func (m *Monitor) Close() error

type NamedDeviceConfig

type NamedDeviceConfig struct {
	DeviceConfig
	AccelProfile *AccelProfile
	Calibration  *Calibration
	Area         *Area
}

type Opener

type Opener interface {
	TakeDevice(path string) (int, Device, error)
	ReleaseDevice(d Device) error
}

type RaisePriority

type RaisePriority func(hand func(what string, job func() error)) (restore func() error)

type Roots

type Roots struct {
	Sys, UdevData string
}

type ScrollMethod

type ScrollMethod uint32
const (
	ScrollNone         ScrollMethod = 0
	ScrollTwoFinger    ScrollMethod = 1 << 0
	ScrollEdge         ScrollMethod = 1 << 1
	ScrollOnButtonDown ScrollMethod = 1 << 2
)

type Subsystem

type Subsystem string
const (
	DRM         Subsystem = "drm"
	Input       Subsystem = "input"
	PowerSupply Subsystem = "power_supply"
)

type TapButtonMap

type TapButtonMap uint32
const (
	TapLRM TapButtonMap = 0
	TapLMR TapButtonMap = 1
)

func (TapButtonMap) String

func (m TapButtonMap) String() string

type UdevDevice

type UdevDevice struct {
	Subsystem  Subsystem
	Syspath    string
	Devnode    string
	Device     Device
	Properties map[string]string
}

func Enumerate

func Enumerate(roots Roots, seat string, subsystems ...Subsystem) ([]UdevDevice, error)

func (UdevDevice) BootVGA

func (d UdevDevice) BootVGA() (bool, error)

func (UdevDevice) Driver

func (d UdevDevice) Driver() (string, error)

Driver names the kernel driver bound to the card, "" for a card without one.

func (UdevDevice) HasRenderNode

func (d UdevDevice) HasRenderNode() (bool, error)

func (UdevDevice) Seat

func (d UdevDevice) Seat() string

type UdevEvent

type UdevEvent struct {
	Action Action
	UdevDevice
}

Jump to

Keyboard shortcuts

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