key

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package key represents keys on the keyboard that the user might type.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StringToKeys

func StringToKeys(s string) iter.Seq[Key]

StringToKeys returns a sequence of Key

Types

type Key

type Key struct {
	Key      string
	Letter   string
	Down, Up bool
	// contains filtered or unexported fields
}

Key represents a single keyboard input. WARNING: This is experimental.

This is currently a simple abstraction, not taking the sequence of modifier keys into consideration. E.g., shift+A would result in keydown (shift), keydown (A with modifer shift: true), keyup (A), and keyup (shift).

This general sequence of events is not yet properly representable in the types.

func RuneToKey

func RuneToKey(r rune) Key

RuneToKey returns a Key representing the keyboard key with the letter specified.

func (Key) EventInit added in v0.9.1

func (k Key) EventInit() uievents.KeyboardEventInit

EventInit creates a KeyboardEventInit representing the key stroke.

Jump to

Keyboard shortcuts

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