diff --git a/internal/mappingrules/matching.go b/internal/mappingrules/matching.go index 7bbad7c..b21245c 100644 --- a/internal/mappingrules/matching.go +++ b/internal/mappingrules/matching.go @@ -11,7 +11,7 @@ func (rule *MappingRuleBase) OutputName() string { } func (rule *MappingRuleBase) modeCheck(mode *string) bool { - if len(rule.Modes) == 1 && rule.Modes[0] == "*" { + if rule.Modes[0] == "*" { return true } return slices.Contains(rule.Modes, *mode) diff --git a/internal/mappingrules/targets.go b/internal/mappingrules/targets.go index 81c6022..bc2129c 100644 --- a/internal/mappingrules/targets.go +++ b/internal/mappingrules/targets.go @@ -20,10 +20,13 @@ func (target *RuleTargetBase) GetDevice() *evdev.InputDevice { } func (target *RuleTargetButton) NormalizeValue(value int32) int32 { - if value == 0 { - return 1 + if target.Inverted { + if value == 0 { + return 1 + } + return 0 } - return 0 + return value } func (target *RuleTargetButton) CreateEvent(value int32, mode *string) *evdev.InputEvent {