joyful/internal/mappingrules/types.go
2025-07-03 17:10:56 -04:00

42 lines
851 B
Go

package mappingrules
import "github.com/holoplot/go-evdev"
type MappingRule interface {
MatchEvent(*evdev.InputDevice, *evdev.InputEvent, *string) *evdev.InputEvent
OutputName() string
}
type MappingRuleBase struct {
Name string
Output RuleTarget
Modes []string
}
// A Simple Mapping Rule can map a button to a button or an axis to an axis.
type SimpleMappingRule struct {
MappingRuleBase
Input RuleTarget
}
// A Combo Mapping Rule can require multiple physical button presses for a single output button
type ComboMappingRule struct {
MappingRuleBase
Inputs []RuleTarget
State int
}
type LatchedMappingRule struct {
MappingRuleBase
Input RuleTarget
State bool
}
type RuleTarget struct {
DeviceName string
ModeSelect []string
Device *evdev.InputDevice
Type evdev.EvType
Code evdev.EvCode
Inverted bool
}