From 68987774fd1c00a0be1b930afe7aa882203e27b3 Mon Sep 17 00:00:00 2001 From: John Gebbie Date: Wed, 4 Jan 2023 22:00:49 +0000 Subject: [PATCH] sleep after not before keypresses --- dotool.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dotool.go b/dotool.go index fbda968..2b8fca9 100644 --- a/dotool.go +++ b/dotool.go @@ -282,30 +282,30 @@ func main() { } if s, ok := cutCmd(text, "key"); ok { for _, field := range strings.Fields(s) { - time.Sleep(keydelay) if chord, err := parseChord(field); err == nil { chord.Press(keyboard) } else { warn(err.Error()) } + time.Sleep(keydelay) } } else if s, ok := cutCmd(text, "keydown"); ok { for _, field := range strings.Fields(s) { - time.Sleep(keydelay) if chord, err := parseChord(field); err == nil { chord.KeyDown(keyboard) } else { warn(err.Error()) } + time.Sleep(keydelay) } } else if s, ok := cutCmd(text, "keyup"); ok { for _, field := range strings.Fields(s) { - time.Sleep(keydelay) if chord, err := parseChord(field); err == nil { chord.KeyUp(keyboard) } else { warn(err.Error()) } + time.Sleep(keydelay) } } else if s, ok := cutCmd(text, "keydelay"); ok { var d float64 @@ -317,13 +317,13 @@ func main() { } } else if s, ok := cutCmd(text, "type"); ok { for _, r := range s { - time.Sleep(typedelay) if chord, ok := runeChords[unicode.ToLower(r)]; ok { if unicode.IsUpper(r) { chord.Shift = true } chord.Press(keyboard) } + time.Sleep(typedelay) } } else if s, ok := cutCmd(text, "typedelay"); ok { var d float64