config

package
v0.12.17 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: MIT Imports: 11 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

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidConfig   = errors.New("invalid config")
	ErrInvalidSettings = errors.New("invalid settings")
)
View Source
var KeyMap = map[rune]input.Key{

	'`':  input.Backquote,
	'~':  shift(input.Backquote),
	'1':  input.Digit1,
	'!':  shift(input.Digit1),
	'2':  input.Digit2,
	'@':  shift(input.Digit2),
	'3':  input.Digit3,
	'#':  shift(input.Digit3),
	'4':  input.Digit4,
	'$':  shift(input.Digit4),
	'5':  input.Digit5,
	'%':  shift(input.Digit5),
	'6':  input.Digit6,
	'^':  shift(input.Digit6),
	'7':  input.Digit7,
	'&':  shift(input.Digit7),
	'8':  input.Digit8,
	'*':  shift(input.Digit8),
	'9':  input.Digit9,
	'(':  shift(input.Digit9),
	'0':  input.Digit0,
	')':  shift(input.Digit0),
	'-':  input.Minus,
	'_':  shift(input.Minus),
	'=':  input.Equal,
	'+':  shift(input.Equal),
	'\\': input.Backslash,
	'|':  shift(input.Backslash),

	'q': input.KeyQ,
	'Q': shift(input.KeyQ),
	'w': input.KeyW,
	'W': shift(input.KeyW),
	'e': input.KeyE,
	'E': shift(input.KeyE),
	'r': input.KeyR,
	'R': shift(input.KeyR),
	't': input.KeyT,
	'T': shift(input.KeyT),
	'y': input.KeyY,
	'Y': shift(input.KeyY),
	'u': input.KeyU,
	'U': shift(input.KeyU),
	'i': input.KeyI,
	'I': shift(input.KeyI),
	'o': input.KeyO,
	'O': shift(input.KeyO),
	'p': input.KeyP,
	'P': shift(input.KeyP),
	'[': input.BracketLeft,
	'{': shift(input.BracketLeft),
	']': input.BracketRight,
	'}': shift(input.BracketRight),

	'a':  input.KeyA,
	'A':  shift(input.KeyA),
	's':  input.KeyS,
	'S':  shift(input.KeyS),
	'd':  input.KeyD,
	'D':  shift(input.KeyD),
	'f':  input.KeyF,
	'F':  shift(input.KeyF),
	'g':  input.KeyG,
	'G':  shift(input.KeyG),
	'h':  input.KeyH,
	'H':  shift(input.KeyH),
	'j':  input.KeyJ,
	'J':  shift(input.KeyJ),
	'k':  input.KeyK,
	'K':  shift(input.KeyK),
	'l':  input.KeyL,
	'L':  shift(input.KeyL),
	';':  input.Semicolon,
	':':  shift(input.Semicolon),
	'\'': input.Quote,
	'"':  shift(input.Quote),

	'z': input.KeyZ,
	'Z': shift(input.KeyZ),
	'x': input.KeyX,
	'X': shift(input.KeyX),
	'c': input.KeyC,
	'C': shift(input.KeyC),
	'v': input.KeyV,
	'V': shift(input.KeyV),
	'b': input.KeyB,
	'B': shift(input.KeyB),
	'n': input.KeyN,
	'N': shift(input.KeyN),
	'm': input.KeyM,
	'M': shift(input.KeyM),
	',': input.Comma,
	'<': shift(input.Comma),
	'.': input.Period,
	'>': shift(input.Period),
	'/': input.Slash,
	'?': shift(input.Slash),

	' ': input.Space,

	'\n': input.Enter,
	'\t': input.Tab,
}
View Source
var SpecialKeyMap = map[string]input.Key{
	"esc":       input.Escape,
	"backspace": input.Backspace,
	"tab":       input.Tab,
	"enter":     input.Enter,
	"left":      input.ArrowLeft,
	"up":        input.ArrowUp,
	"right":     input.ArrowRight,
	"down":      input.ArrowDown,
	"space":     input.Space,
}

Functions

This section is empty.

Types

type Action

type Action interface {
	String() string
}

func ParseAction

func ParseAction(stgs *Settings, v any) (Action, error)

type Config

type Config struct {
	Settings *Settings
	Actions  []Action
}

func Decode

func Decode(r io.Reader) (*Config, error)

func DecodeMap

func DecodeMap(m map[string]any) (*Config, error)

func Load

func Load(name string) (*Config, error)

type CtrlAction

type CtrlAction struct {
	Ctrl  string `mapstructure:"ctrl"`
	Count int    `mapstructure:"count"`
	Speed int    `mapstructure:"speed"`
}

func (*CtrlAction) String

func (action *CtrlAction) String() string

type ErrInvalidAction

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

func NewErrInvalidAction

func NewErrInvalidAction(action any) ErrInvalidAction

func (ErrInvalidAction) Error

func (err ErrInvalidAction) Error() string

type KeyAction

type KeyAction struct {
	Key   string `mapstructure:"key"`
	Count int    `mapstructure:"count"`
	Speed int    `mapstructure:"speed"`
}

func (*KeyAction) String

func (action *KeyAction) String() string

type PauseAction

type PauseAction struct{}

func (*PauseAction) String

func (*PauseAction) String() string

type ScreenshotAction

type ScreenshotAction struct {
	Screenshot *string `mapstructure:"screenshot"`
}

func (*ScreenshotAction) String

func (action *ScreenshotAction) String() string

type Settings

type Settings struct {
	LoginCommand        []string `mapstructure:"loginCommand"`
	FontSize            int      `mapstructure:"fontSize"`
	FontFamily          *string  `mapstructure:"fontFamily"`
	DefaultSpeed        int      `mapstructure:"defaultSpeed"`
	SkipPauseBeforeQuit bool     `mapstructure:"skipPauseBeforeQuit"`
	ScreenshotsDir      string   `mapstructure:"screenshotsDir"`
	BrowserBin          *string  `mapstructure:"browserBin"`
	Headless            bool     `mapstructure:"headless"`
	Width               *int     `mapstructure:"width"`
	Height              *int     `mapstructure:"height"`
}

func DecodeSettings

func DecodeSettings(m map[string]any) (*Settings, error)

type SleepAction

type SleepAction struct {
	Sleep int `mapstructure:"sleep"`
}

func (*SleepAction) String

func (action *SleepAction) String() string

type TypeAction

type TypeAction struct {
	Type  string `mapstructure:"type"`
	Count int    `mapstructure:"count"`
	Speed int    `mapstructure:"speed"`
}

func (*TypeAction) String

func (action *TypeAction) String() string

Jump to

Keyboard shortcuts

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