inputmacro

package
v2.17.2 Latest Latest
Warning

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

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

Documentation

Overview

Package inputmacro classifies control tokens shared by input transports and emitters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KeyForToken added in v2.17.2

func KeyForToken(token string) (key string, ok bool)

KeyForToken returns the key or button name a token acts on, in the braced form the key tables and config allow/block lists use. Control tokens are unwrapped so the key they act on is what gets validated — otherwise "{press:super}" would slip past a "{super}" block list entry. Delay tokens carry a duration rather than a key and report false.

func SplitHold added in v2.17.2

func SplitHold(value string) (name, duration string)

SplitHold separates a hold token's value into the key name and its optional duration ("esc:500" -> "esc", "500").

Types

type Action

type Action uint8

Action identifies an inline input macro control operation.

const (
	ActionNone Action = iota
	ActionDelay
	ActionPress
	ActionRelease
	ActionHold
)

type Control

type Control struct {
	Value  string
	Action Action
}

Control describes a recognized inline input macro token.

func ClassifyControl

func ClassifyControl(token string) Control

ClassifyControl recognizes braced delay, press, release, and hold tokens, including their sigil forms. Non-control tokens return ActionNone.

Jump to

Keyboard shortcuts

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