Documentation ¶
Index ¶
- Constants
- Variables
- func Parse() ([]mode, []switch_, error)
- type ButtonCondition
- type ButtonInput
- type ButtonSwitch
- type ButtonTrigger
- type CursorBoost
- type EnableGyro
- type ExecSpeech
- type FlushVoice
- type Gyro
- type GyroCondition
- type GyroMode
- type GyroTrigger
- type Hotkey
- type IdleMode
- type Input
- type InputType
- type Mode
- type ModeConfig
- type ModeManager
- type Modifier
- type MouseClick
- type MouseToggle
- type MoveCursor
- type Repeat
- type RestoreMode
- type Speak
- type SpeechCondition
- type SpeechInput
- type SpeechMode
- type SpeechTrigger
- type StickDirectionCondition
- type StickDirectionSwitch
- type StickDirectionTrigger
- type StickInput
- type StickMoveCondition
- type StickMoveTrigger
- type Switch
- type SwitchMode
- type SwitchResult
- type SysNotify
- type TextPrefix
- type Trigger
- type TriggerResult
Constants ¶
const ( InputType_None = iota // for always-on-trigger InputType_Button InputType_Stick InputType_Gyro InputType_Speech )
const ( Tag_Repeat = "[repeat]" Tag_CaseCamel = "[camel]" Tag_CaseTitle = "[title]" Tag_CaseUpper = "[upper]" Tag_CaseSnake = "[snake]" )
Variables ¶
var Manager = &ModeManager{}
global variable
var ModeList []ModeConfig
var PhraseList map[string][]string
var WordMapping map[string][]string
Functions ¶
Types ¶
type ButtonCondition ¶
type ButtonCondition struct {
// contains filtered or unexported fields
}
If the *Input matches Up/Down event of specified key
func (*ButtonCondition) Satisfy ¶
func (bc *ButtonCondition) Satisfy(in *Input) bool
type ButtonInput ¶
type ButtonInput struct {
Up, Down, Curr *joycon.ButtonState
}
type ButtonSwitch ¶
type ButtonSwitch struct {
Switch
}
A switch that is turned on On/Off by Button down/up
func NewButtonSwitch ¶
func NewButtonSwitch(btnId joycon.ButtonID) *ButtonSwitch
type ButtonTrigger ¶
type ButtonTrigger struct {
Trigger
}
func NewButtonTrigger ¶
func NewButtonTrigger( btnId joycon.ButtonID, whenDown bool, a action, ) *ButtonTrigger
type CursorBoost ¶
type CursorBoost struct { Modifier // contains filtered or unexported fields }
Boost cursor move speed or slow it down
func NewCursorBoost ¶
func NewCursorBoost(multiplier float64) *CursorBoost
func (*CursorBoost) Modify ¶
func (cb *CursorBoost) Modify(in *Input)
type EnableGyro ¶
type EnableGyro struct {
// contains filtered or unexported fields
}
func (*EnableGyro) Do ¶
func (eg *EnableGyro) Do(in *Input)
type ExecSpeech ¶
type ExecSpeech struct {
// contains filtered or unexported fields
}
func NewExecSpeech ¶
func NewExecSpeech( castNumber, noSpace, typing bool, mappings []string, ) (*ExecSpeech, error)
func (*ExecSpeech) Do ¶
func (es *ExecSpeech) Do(in *Input)
type FlushVoice ¶
type FlushVoice struct{}
`FlushVoice` forces speech engine stop waiting for further data and return the result immediately
func (*FlushVoice) Do ¶
func (fv *FlushVoice) Do(*Input)
type GyroCondition ¶
type GyroCondition struct{}
return true if there is gyro signal
func (*GyroCondition) Satisfy ¶
func (sc *GyroCondition) Satisfy(in *Input) bool
type GyroTrigger ¶
type GyroTrigger struct {
Trigger
}
func NewGyroTrigger ¶
func NewGyroTrigger( a action, ) *GyroTrigger
type Hotkey ¶
type Hotkey struct {
// contains filtered or unexported fields
}
just use the `hotkey` of `word executor`
type IdleMode ¶
type IdleMode struct {
Mode
}
A mode that does nothing, used as default mode
func NewIdleMode ¶
type Input ¶
type Input struct { Type InputType Jc joycon.Controller // button *ButtonInput // stick *StickInput // gyro *Gyro // text *SpeechInput }
type Mode ¶
type Mode struct {
// contains filtered or unexported fields
}
`Mode` is a container of modifier switches and action triggers, it passes all Input events to them
func (*Mode) SetActions ¶
func (m *Mode) SetActions(t []trigger)
func (*Mode) SetSwitches ¶
func (m *Mode) SetSwitches(sw map[switch_]modifier)
type ModeConfig ¶
type ModeManager ¶
type ModeManager struct {
// contains filtered or unexported fields
}
func (*ModeManager) CurrentMode ¶
func (l *ModeManager) CurrentMode() mode
func (*ModeManager) DefaultMode ¶
func (l *ModeManager) DefaultMode() mode
func (*ModeManager) Handle ¶
func (l *ModeManager) Handle(in *Input)
func (*ModeManager) SetModes ¶
func (l *ModeManager) SetModes(list []mode, modeSwitches []switch_) error
Set modes from configuration file, the first is set as default mode
type MouseClick ¶
type MouseClick struct {
// contains filtered or unexported fields
}
func NewMouseClick ¶
func NewMouseClick(button string, isDouble bool) *MouseClick
func (*MouseClick) Do ¶
func (mc *MouseClick) Do(*Input)
type MouseToggle ¶
type MouseToggle struct {
// contains filtered or unexported fields
}
func NewMouseDown ¶
func NewMouseDown(button string) *MouseToggle
func NewMouseToggle ¶
func NewMouseToggle(button, downUp string) *MouseToggle
func NewMouseUp ¶
func NewMouseUp(button string) *MouseToggle
func (*MouseToggle) Do ¶
func (md *MouseToggle) Do(*Input)
type MoveCursor ¶
type MoveCursor struct {
// contains filtered or unexported fields
}
Cursor movement JoyCon's packet push inerval is 15ms `robotgo.MoveRelative` takes < 2ms
func NewMoveCursor ¶
func NewMoveCursor(speed float64) *MoveCursor
func (*MoveCursor) Do ¶
func (mc *MoveCursor) Do(in *Input)
type RestoreMode ¶
type RestoreMode struct{}
Restore to default mode
func (*RestoreMode) Do ¶
func (rm *RestoreMode) Do(in *Input)
type Speak ¶
type Speak struct {
// contains filtered or unexported fields
}
`Speak` simulate a speech, throw it to the word executor, normally used for complex macro that cannot be done with a simple action. For example, if we want to: win+R -> delay-1-second -> type"calc.exe" -> enter -> delay-1-second -> type"1+1=" this can only be done with word executors, hence a [speech] trigger must be set in that mode.
type SpeechCondition ¶
type SpeechCondition struct{}
return true if there is speech signal
func (*SpeechCondition) Satisfy ¶
func (sc *SpeechCondition) Satisfy(in *Input) bool
type SpeechInput ¶
type SpeechInput struct {
Text string
}
type SpeechMode ¶
type SpeechMode struct { Mode // contains filtered or unexported fields }
func NewSpeechMode ¶
func NewSpeechMode( modeId, engine, host string, phraseIds []string, flushOnExit bool, ) (*SpeechMode, error)
func (*SpeechMode) OnEnter ¶
func (sp *SpeechMode) OnEnter(*Input) error
Start monitoring microphone input and send captured voice data to recognition engine.
func (*SpeechMode) OnExit ¶
func (sp *SpeechMode) OnExit(*Input) error
type SpeechTrigger ¶
type SpeechTrigger struct {
Trigger
}
func NewSpeechTrigger ¶
func NewSpeechTrigger( a action, ) *SpeechTrigger
type StickDirectionCondition ¶
type StickDirectionCondition struct {
// contains filtered or unexported fields
}
5 enter and 5 leave events for: U D L R Center
func (*StickDirectionCondition) Satisfy ¶
func (sc *StickDirectionCondition) Satisfy(in *Input) bool
type StickDirectionSwitch ¶
type StickDirectionSwitch struct { Switch // contains filtered or unexported fields }
A switch that is turned on On/Off by spinning stick to the specified direction
func NewStickDirectionSwitch ¶
func NewStickDirectionSwitch(side joycon.JoyConSide, dir joycon.SpinDirection) *StickDirectionSwitch
type StickDirectionTrigger ¶
type StickDirectionTrigger struct {
Trigger
}
func NewStickDirectionTrigger ¶
func NewStickDirectionTrigger( side joycon.JoyConSide, dir joycon.SpinDirection, a action, ) *StickDirectionTrigger
type StickInput ¶
type StickInput struct { Side joycon.JoyConSide Ratio *joycon.Ratio Direction joycon.SpinDirection }
type StickMoveCondition ¶
type StickMoveCondition struct {
// contains filtered or unexported fields
}
check if there is specified stick movement event
func (*StickMoveCondition) Satisfy ¶
func (sc *StickMoveCondition) Satisfy(in *Input) bool
type StickMoveTrigger ¶
type StickMoveTrigger struct {
Trigger
}
func NewStickMoveTrigger ¶
func NewStickMoveTrigger( side joycon.JoyConSide, a action, ) *StickMoveTrigger
type Switch ¶
type Switch struct {
// contains filtered or unexported fields
}
A convenient class for default members
func (*Switch) GetOffTrigger ¶
func (s *Switch) GetOffTrigger() trigger
func (*Switch) GetOnTrigger ¶
func (s *Switch) GetOnTrigger() trigger
func (*Switch) Handle ¶
func (s *Switch) Handle( in *Input, ) SwitchResult
func (*Switch) SetOffTrigger ¶
func (s *Switch) SetOffTrigger(t trigger)
func (*Switch) SetOnTrigger ¶
func (s *Switch) SetOnTrigger(t trigger)
type SwitchMode ¶
type SwitchMode struct {
// contains filtered or unexported fields
}
Mode Switcher
func NewSwitchMode ¶
func NewSwitchMode(modeId string) *SwitchMode
func (*SwitchMode) Do ¶
func (sm *SwitchMode) Do(in *Input)
type SwitchResult ¶
type SwitchResult int
const ( SwitchedOn SwitchResult = iota SwitchedOff SwitchNotChange )
type SysNotify ¶
type SysNotify struct {
// contains filtered or unexported fields
}
Popup a system notification with specified Title/Text/Icon
func NewSysNotify ¶
type TextPrefix ¶
type TextPrefix struct { Modifier // contains filtered or unexported fields }
func (*TextPrefix) Modify ¶
func (tp *TextPrefix) Modify(in *Input)
type Trigger ¶
type Trigger struct {
// contains filtered or unexported fields
}
A convenient class for default members
func (*Trigger) GetCondition ¶
func (t *Trigger) GetCondition() condition
func (*Trigger) Handle ¶
func (t *Trigger) Handle(in *Input) TriggerResult
func (*Trigger) SetCondition ¶
func (t *Trigger) SetCondition(c condition)