keyboardmap

package
v2.18.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const LeftShiftCode = 42

LeftShiftCode is the key held to type a shift-modified character.

Variables

View Source
var KeyboardMap = map[string]int{}/* 151 elements not displayed */
View Source
var LegacyKeyboardMap map[int]string

Functions

func ExpandShift added in v2.18.0

func ExpandShift(codes []int) []int

ExpandShift turns a list of map codes into the physical keys to press. Shift-modified (negative) codes become their base code, with LeftShift inserted before the first of them unless a Shift already precedes it. A code that appears more than once is kept only at its first position.

func GetLegacyKey

func GetLegacyKey(key int) string

func IsShiftedKey added in v2.15.0

func IsShiftedKey(name string) (baseCode int, ok bool)

IsShiftedKey reports whether name maps to a shift-modified key (negative code). If so, it returns the positive base keycode that must be pressed while LeftShift is held. Returns 0, false for unshifted keys, braced specials that are not shift-modified, and unknown names.

func ParseKeyCombo added in v2.18.0

func ParseKeyCombo(arg string) (codes []int, isCombo bool, err error)

ParseKeyCombo parses a keyboard key argument string and returns the corresponding key codes. It supports both single keys (e.g., "a", "{f9}") and combo keys with the "+" delimiter (e.g., "{ctrl+q}", "{shift+a}").

The function returns:

  • codes: slice of keyboard codes
  • isCombo: true if multiple keys detected, false for a single key
  • error: if any key name is unknown

Examples:

  • ParseKeyCombo("a") -> [30], false, nil
  • ParseKeyCombo("{f9}") -> [67], false, nil
  • ParseKeyCombo("{ctrl+q}") -> [29, 16], true, nil
  • ParseKeyCombo("{shift+a}") -> [42, 30], true, nil

func SetupLegacyKeyboardMap

func SetupLegacyKeyboardMap()

func ToKeyboardCode added in v2.18.0

func ToKeyboardCode(name string) (int, bool)

ToKeyboardCode converts a single ZapScript key symbol to a keyboard code.

Types

This section is empty.

Jump to

Keyboard shortcuts

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