robotgo icon indicating copy to clipboard operation
robotgo copied to clipboard

If you press a key such as left or right once, the "fn" key remains pressed thereafter.

Open yowpark opened this issue 1 year ago • 0 comments

  • Robotgo version (or commit ref): v1.0.0-beta5, v1.0.0-rc2.1
  • Go version: go version go1.18.4 darwin/arm64
  • Gcc version: Apple clang version 14.0.0 (clang-1400.0.29.202) Target: arm64-apple-darwin22.1.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
  • Operating system and bit: macOS / arm64, M2 MacBook Pro
  • Resolution:
  • Can you reproduce the bug at Examples:
    • [x] Yes (provide example code)
    • [ ] No
    • [ ] Not relevant
  • Provide example code:
package main

import (
	"github.com/go-vgo/robotgo"
)

func run() {
	robotgo.Sleep(5)

	seqs := [][]string{
		{"left"},
		{"f"},
		{"left", "up"},
		{"f", "up"},
	}

	for _, s := range seqs {
		var metaInterfaces []interface{}
		for i := 1; i < len(s); i++ {
			metaInterfaces = append(metaInterfaces, s[i])
		}
		robotgo.KeyToggle(s[0], metaInterfaces...)
		robotgo.MilliSleep(300)

		// with robotgo under v1.0.0-beta5
		// sExceptFirst := s[1:]
		// robotgo.KeyToggle(s[0], sExceptFirst...)
		// robotgo.MilliSleep(300)
	}
}

func main() {
	run()
}

  • Log gist:

Description

In the macOS environment, if you press the left or right key, the fn key has been pressed since then, so even if you simply press the "f" key, the "fn + f" key is pressed and the app changes to full screen.

After executing the above code with go run ., go to a web browser such as Chrome or Safari and click the url inputfield. If normal, the keyboard caret should move to the left and the letter f should be entered. However, the letter f is not entered and apps such as Chrome or Safari change to full screen.

It was possible to reproduce from v1.0.0-beta5 or higher, but could not be reproduced from v1.0.0-beta4 or lower.

yowpark avatar Sep 13 '23 02:09 yowpark