dictionary

package
v0.0.0-...-0957072 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Brief

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

func ParseBrief

func ParseBrief(in string) (*Brief, error)

func SingleStrokeBrief

func SingleStrokeBrief(k Keymask) *Brief

func (*Brief) String

func (b *Brief) String() string

type Dictionary

type Dictionary map[*Brief]string

Dictionary represents a mapping of briefs to qwertystrokes

func ReadFile

func ReadFile(filename string) (*Dictionary, error)

func (*Dictionary) MarshalJSON

func (d *Dictionary) MarshalJSON() ([]byte, error)

func (*Dictionary) MustNotCollideWith

func (d *Dictionary) MustNotCollideWith(other *Dictionary) []error

type Factory

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

Factory allows a caller to generate a dictionary, using certain options.

func NewFactory

func NewFactory(opts FactoryOpts) *Factory

NewFactory builds a new dictionary factory. If `opts` is nil, it will use DefaultFactoryOpts.

func (*Factory) Generate

func (f *Factory) Generate(r *Rules) *Dictionary

Generate tells the receiver to build a dictionary. The base set of definitions will include the following: - Navigation strokes (layer-esc, layer-space, layer-tab, layer-return, layer-home, layer-pageUp, layer-pageDown, layer-end, layer-backspace, layer-delete, layer-up, layer-down, layer-left, layer-right) - Modifier+Navigation strokes (e.g. shift-esc, ctrl-esc, alt-esc, gui-esc, shift-ctrl-esc, shift-alt-esc, shift-gui-esc, ctrl-alt-esc, alt-gui-esc, shift-ctrl-alt-esc, shift-alt-gui-esc) Based on the receivers options, the factory may generate more definitions: - More combinations of modifiers, applied to all other definitions (ctrl-gui-, shift-ctrl-gui-, ctrl-alt-gui-, shift-ctrl-alt-gui-) - Fingerspelling strokes (e.g. shift-S, ctrl-S, alt-S, gui-S, shift-ctrl-S, shift-alt-S, shift-gui-S, ctrl-alt-S, alt-gui-S, shift-ctrl-alt-S, shift-alt-gui-S) - Left-hand Number strokes (e.g. shift-1, ctrl-1, alt-1, gui-1, shift-ctrl-1, shift-alt-1, shift-gui-1, ctrl-alt-1, alt-gui-1, shift-ctrl-alt-1, shift-alt-gui-1) - Left-hand Function strokes (replaces Left-hand Number strokes 1-5 and 0 with F1-F5 and F12, respectively)

type FactoryOpts

type FactoryOpts struct {
	// NonstandardModCombinations tells the factory to generate strokes for the
	// modifier combinations ctrl-gui, shift-ctrl-gui, ctrl-alt-gui, and
	// shift-ctrl-alt-gui ("hyper")
	NonstandardModCombinations bool
	// Fingerspellings tells the factory to generate strokes for all
	// fingerspellings (with the alteration that * is not included in the
	// fingerspelling, to leave it open for modifier masks)
	Fingerspellings bool
	// NumbersLeft tells the factory to generate strokes using # and S-, T-,
	// P-, H-, A and O
	NumbersLeft NumberOption
	// NumberStarsLeft tells the factory to generate strokes using #* and S-,
	// T-, P-, H-, A and O
	NumberStarsLeft NumberOption
}

FactoryOpts represents a set of options for the factory to use during generation.

type Keymask

type Keymask uint32

Keymask is a bitmask for steno keys

const (
	Num    Keymask = 1 << 22
	LeftS  Keymask = 1 << 21
	LeftT  Keymask = 1 << 20
	LeftK  Keymask = 1 << 19
	LeftP  Keymask = 1 << 18
	LeftW  Keymask = 1 << 17
	LeftH  Keymask = 1 << 16
	LeftR  Keymask = 1 << 15
	LeftA  Keymask = 1 << 14
	LeftO  Keymask = 1 << 13
	Star   Keymask = 1 << 12
	RightE Keymask = 1 << 11
	RightU Keymask = 1 << 10
	RightF Keymask = 1 << 9
	RightR Keymask = 1 << 8
	RightP Keymask = 1 << 7
	RightB Keymask = 1 << 6
	RightL Keymask = 1 << 5
	RightG Keymask = 1 << 4
	RightT Keymask = 1 << 3
	RightS Keymask = 1 << 2
	RightD Keymask = 1 << 1
	RightZ Keymask = 1

	Steno1 Keymask = Num | LeftS
	Steno2 Keymask = Num | LeftT
	Steno3 Keymask = Num | LeftP
	Steno4 Keymask = Num | LeftH
	Steno5 Keymask = Num | LeftA
	Steno6 Keymask = Num | RightF
	Steno7 Keymask = Num | RightP
	Steno8 Keymask = Num | RightL
	Steno9 Keymask = Num | RightT
	Steno0 Keymask = Num | LeftO
)

The steno keyboard keys

func ParseStroke

func ParseStroke(in string) (Keymask, error)

ParseStroke takes in a string (e.g. "STPH") and returns a Keymask or an error.

func (Keymask) String

func (k Keymask) String() string

type NumberOption

type NumberOption int
const (
	// NumberOptionDisabled turns off generation for this numbers option
	NumberOptionDisabled NumberOption = NumberOption(iota)
	// NumberOptionNumbers generates 1-5 and 0 for this numbers option
	// (S=1, T=2, P=3, H=4, A=5, O=0)
	NumberOptionNumbers NumberOption = NumberOption(iota)
	// NumberOptionNumbersHigh generates 5-9 and 0 for this numbers option
	// (S=6, T=7, P=8, H=9, A=5, O=0)
	NumberOptionNumbersHigh NumberOption = NumberOption(iota)
	// NumberOptionFunctions generates F1-F5 and F12 for this numbers option
	// (S=F1, T=F2, P=F3, H=F4, A=F5, O=F12)
	NumberOptionFunctions NumberOption = NumberOption(iota)
	// NumberOptionFunctionsHigh generate F6-F11 for this numbers option
	// (S=F6, T=F7, P=F8, H=F9, A=F10, O=F11)
	NumberOptionFunctionsHigh NumberOption = NumberOption(iota)
)

type QwertyKey

type QwertyKey string
const (
	Escape    QwertyKey = "Escape"
	Space     QwertyKey = "Space"
	Tab       QwertyKey = "Tab"
	Return    QwertyKey = "Return"
	Home      QwertyKey = "Home"
	PageUp    QwertyKey = "Page_Up"
	PageDown  QwertyKey = "Page_Down"
	End       QwertyKey = "End"
	Backspace QwertyKey = "BackSpace"
	Delete    QwertyKey = "Delete"
	Left      QwertyKey = "Left"
	Up        QwertyKey = "Up"
	Down      QwertyKey = "Down"
	Right     QwertyKey = "Right"
	QwertyA   QwertyKey = "a"
	QwertyB   QwertyKey = "b"
	QwertyC   QwertyKey = "c"
	QwertyD   QwertyKey = "d"
	QwertyE   QwertyKey = "e"
	QwertyF   QwertyKey = "f"
	QwertyG   QwertyKey = "g"
	QwertyH   QwertyKey = "h"
	QwertyI   QwertyKey = "i"
	QwertyJ   QwertyKey = "j"
	QwertyK   QwertyKey = "k"
	QwertyL   QwertyKey = "l"
	QwertyM   QwertyKey = "m"
	QwertyN   QwertyKey = "n"
	QwertyO   QwertyKey = "o"
	QwertyP   QwertyKey = "p"
	QwertyQ   QwertyKey = "q"
	QwertyR   QwertyKey = "r"
	QwertyS   QwertyKey = "s"
	QwertyT   QwertyKey = "t"
	QwertyU   QwertyKey = "u"
	QwertyV   QwertyKey = "v"
	QwertyW   QwertyKey = "w"
	QwertyX   QwertyKey = "x"
	QwertyY   QwertyKey = "y"
	QwertyZ   QwertyKey = "z"
	F1        QwertyKey = "F1"
	F2        QwertyKey = "F2"
	F3        QwertyKey = "F3"
	F4        QwertyKey = "F4"
	F5        QwertyKey = "F5"
	F6        QwertyKey = "F6"
	F7        QwertyKey = "F7"
	F8        QwertyKey = "F8"
	F9        QwertyKey = "F9"
	F10       QwertyKey = "F10"
	F11       QwertyKey = "F11"
	F12       QwertyKey = "F12"
	N1        QwertyKey = "1"
	N2        QwertyKey = "2"
	N3        QwertyKey = "3"
	N4        QwertyKey = "4"
	N5        QwertyKey = "5"
	N6        QwertyKey = "6"
	N7        QwertyKey = "7"
	N8        QwertyKey = "8"
	N9        QwertyKey = "9"
	N0        QwertyKey = "0"
)

type QwertyMod

type QwertyMod string
const (
	Shift QwertyMod = "Shift_L(%s)"
	Ctrl  QwertyMod = "Control_L(%s)"
	Alt   QwertyMod = "Alt_L(%s)"
	Gui   QwertyMod = "Super_L(%s)"
)

type Rules

type Rules struct {
	Escape    Keymask
	Space     Keymask
	Tab       Keymask
	Return    Keymask
	Home      Keymask
	PageUp    Keymask
	PageDown  Keymask
	End       Keymask
	Backspace Keymask
	Delete    Keymask
	Up        Keymask
	Down      Keymask
	Left      Keymask
	Right     Keymask
	Layer     Keymask
	Shift     Keymask
	Ctrl      Keymask
	Alt       Keymask
	Gui       Keymask
}

func ReadRulesFile

func ReadRulesFile(filename string) (*Rules, error)

func (*Rules) MustBeValid

func (r *Rules) MustBeValid() []error

func (*Rules) UnmarshalJSON

func (r *Rules) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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