keytest

package
v0.3.14 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: MIT Imports: 4 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 keytest drives the shell's surfaces on a private headless sway from a virtual keyboard whose keymap, like wtype's or a remote-desktop peer's, carries its keys on codes of its own: each one on the code a physical keyboard gives a different key. A surface that reads its keys through the keymap acts on them; one that matches evdev codes acts on the wrong ones.

Index

Constants

View Source
const (
	// Return is on evdev 1, a physical keyboard's Escape.
	Return = 1
	// Escape is on evdev 28, a physical keyboard's Return.
	Escape = 28
	// L is on evdev 35, a physical keyboard's H.
	L = 35
	// H is on evdev 38, a physical keyboard's L.
	H = 38
	// Tab is on evdev 30, a physical keyboard's A.
	Tab = 30
	// Space is on evdev 31, a physical keyboard's S.
	Space = 31
	// Left is on evdev 32, a physical keyboard's D.
	Left = 32
	// Right is on evdev 33, a physical keyboard's F.
	Right = 33
	// Up is on evdev 34, a physical keyboard's G.
	Up = 34
	// Down is on evdev 36, a physical keyboard's J.
	Down = 36
	// PageUp is on evdev 37, a physical keyboard's K.
	PageUp = 37
	// PageDown is on evdev 44, a physical keyboard's Z.
	PageDown = 44
)

The evdev codes the keyboard types its keys on, each the code of another key on a physical keyboard.

Variables

This section is empty.

Functions

func AwaitFocus

func AwaitFocus(t *testing.T, a *app.Application)

AwaitFocus waits until one of a's surfaces holds the keyboard, so the keys tapped next reach it.

Types

type Keyboard

type Keyboard struct {
	*vinput.Device
	// contains filtered or unexported fields
}

Keyboard is the remapped virtual keyboard, with a pointer, typing to an application.

func Dial

func Dial(t *testing.T, a *app.Application) *Keyboard

Dial connects the remapped keyboard to the sway apptest.Run started for a.

func (*Keyboard) CtrlTap

func (k *Keyboard) CtrlTap(code uint32)

CtrlTap taps the key on code with Control held.

func (*Keyboard) Tap

func (k *Keyboard) Tap(code uint32)

Tap presses and releases the key on code and returns once the application has handled both, so what the key does (or does not do) is there to observe.

Jump to

Keyboard shortcuts

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