Make modeless operation work more cleanly / remove implicit "main" mode.
This commit is contained in:
parent
acba227843
commit
288a07eb73
3 changed files with 7 additions and 4 deletions
|
@ -81,7 +81,7 @@ func main() {
|
|||
logger.Logf("registered %d timers", timerCount)
|
||||
|
||||
// initialize the mode variable
|
||||
mode := "main"
|
||||
mode := config.GetModes()[0]
|
||||
|
||||
fmt.Println("Joyful Running! Press Ctrl+C to quit.")
|
||||
for {
|
||||
|
|
|
@ -69,6 +69,9 @@ func (parser *ConfigParser) Parse(directory string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (parser *ConfigParser) getModes() []string {
|
||||
return append([]string{"main"}, parser.config.Modes...)
|
||||
func (parser *ConfigParser) GetModes() []string {
|
||||
if len(parser.config.Modes) == 0 {
|
||||
return []string{"*"}
|
||||
}
|
||||
return parser.config.Modes
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import (
|
|||
// For very large rule-bases this may be helpful for staying performant.
|
||||
func (parser *ConfigParser) BuildRules(pDevs map[string]*evdev.InputDevice, vDevs map[string]*evdev.InputDevice) []mappingrules.MappingRule {
|
||||
rules := make([]mappingrules.MappingRule, 0)
|
||||
modes := parser.getModes()
|
||||
modes := parser.GetModes()
|
||||
|
||||
for _, ruleConfig := range parser.config.Rules {
|
||||
var newRule mappingrules.MappingRule
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue