evdev

package
v0.0.0-...-155abb7 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: GPL-3.0 Imports: 11 Imported by: ? 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

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

Device represents an evdev input device.

type Handler

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

Handler manages evdev input devices.

func NewHandler

func NewHandler() *Handler

NewHandler creates a new evdev input handler.

func (*Handler) Close

func (h *Handler) Close() error

Close closes all devices.

func (*Handler) Devices

func (h *Handler) Devices() []string

Devices returns information about opened devices.

func (*Handler) Events

func (h *Handler) Events() <-chan gfxinput.Event

Events returns the event channel.

func (*Handler) MousePosition

func (h *Handler) MousePosition() (x, y int)

MousePosition returns the current mouse position.

func (*Handler) Open

func (h *Handler) Open() error

Open scans for and opens input devices.

func (*Handler) Poll

func (h *Handler) Poll() *gfxinput.Event

Poll returns the next event or nil if none available.

func (*Handler) SetLayout

func (h *Handler) SetLayout(layout KeyboardLayout)

SetLayout sets the keyboard layout.

func (*Handler) SetScreenSize

func (h *Handler) SetScreenSize(width, height int)

SetScreenSize sets the screen size for mouse bounds.

func (*Handler) Start

func (h *Handler) Start()

Start begins reading events from all devices.

func (*Handler) Stop

func (h *Handler) Stop()

Stop stops reading events.

func (*Handler) Wait

func (h *Handler) Wait(timeout time.Duration) *gfxinput.Event

Wait waits for the next event with a timeout.

type KeyboardLayout

type KeyboardLayout string

KeyboardLayout represents a keyboard layout.

const (
	LayoutUS KeyboardLayout = "us"
	LayoutUK KeyboardLayout = "uk"
	LayoutDE KeyboardLayout = "de"
)

Jump to

Keyboard shortcuts

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