Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    Can anyone help me with the robotgo library? Having trouble when doing "go get github.com/go-vgo/robotgo". I think I don't have something setup correctly and can't figure out what.
    Ok,what is the problem?
    Hello. I have some hopefully quick questions. By the way, robotgo is amazing. Thank you for creating this :) I was wondering about robotgo's "FindBitmap" feature. Will it eventually have similar capabilities as Sikuli's "Find"? http://sikulix-2014.readthedocs.io/en/latest/region.html#Region.find
    Ok, Find an image on screen and read pixels from an image will be update. Until it is really reasonable, FindBitmap is failing now.
    Ok thanks for the info. :)
    Anton Södergren
    Hi! Thanks for a nice library. Is it possible to watch multiple events at the same time? I can only get one to work with go routines. Maybe I have misunderstood the syntax
    is anyone here?
    maybe, i found a bug
    about TypeString()
    i have wirte an issue , maybe you can see it after wake up
    how can i build linux executables on windows that used tobotgo
    i build success on windows but when i set GOOS=linux there is a error says no buildable Go source files
    Because dependent on cgo and zlib/libpng, cross-platform compilation is difficult.


    github.com/go-vgo/robotgo(DATA/const): unexpected reloc for dynamic symbol _NSConcreteGlobalBlock
    cannot free bitmap ,no method provide
    loop call CaptureScreen will ...
    Ok, I will consider increasing the api.
    hello ,There is way to listener all keyboard input event?
    Can anyone help me?
    How can I convert the CaptureScreen() or BCaptureScreen() into a golang []byte. Alternatively something that implements the image.Image interface.
    Georg Steyn
    Hello. Any suggestion on how to click on the centre of the bitmap?
    I would assume Open Bitmap -> Get Size -> Calculate centre -> Click centre
    Florian Frouin
    Hi !
    Is there a way to use robotgo on a headless server only to use the keyboard inputs ?
    Hi here ! Does anyone know how to cross compile (archlinux to windows) it's not really clear and i'm lost with x86_64-w64-mingw32-gcc
    I don't even know if it possible with robotgo
    Thanks !
    Connor Jarvis
    Hey is this active?
    Cauê Felchar
    Hello everyone, i'm trying to help the project out a bit, I made some changes to the project event hooking API
    i've commited my current changes htmk/robotgo@6575f93
    Is there any reason why the hook can't be kept active? in other words, can the dispatch function be kept running?
    Ryan Sullivan
    Hello! Before I open an issue I just wanted to check and make sure I didn't miss anything. I can not seem to get input working on macOS Mojave. I understand its beta and may not be supported. I'm checking to see if that's the case or if there are some pitfalls to getting input working on macOS. Move(x,y) TypeString() etc are not working. I can read values from the screen, get mouse position, etc just fine. Seems like anything dealing with Input does not work. The application is not crashing or anything like that. Just nothing happens. Is this to be expected? Or could this be a compatibility issue with the new os?
    Ryan Sullivan
    I found that by compiling the program and running it normally macOS give you the "Terminal wants to control your computer" prompt to allow the mouse/keyboard takeover. Only issue is when running it with go run while developing this does not seem to work.
    Ryan Sullivan
    Nvm I just had to enable iTerm2 as well in the security panel
    Is there anything like "mouse up" and "mouse down" events ?

    For the hotkey monitoring implementation I want to use goroutine+AddEvents/AddEvent

    Example code:

    package main
    import (
    func main() {
        go addKeysListen("q", "ctrl")
        go addKeyListen("k")
        for {
            // do something
            time.Sleep(time.Millisecond * 50)
    func addKeysListen(key string, arr ...string) {
        for {
            if ok := robotgo.AddEvents(key, arr...); ok {
                fmt.Println("pressed Ctrl + q")
    func addKeyListen(key string) {
        for {
            if ok := robotgo.AddEvent(key); ok {
                fmt.Println("Pressed k")

    If I only listen to a hotkey, it is ok, but more than one will fail.
    Can you change the underlying code to support this type of writing? Or has a more elegant solution?

    github:clipboard recorder.

    Cauê Felchar
    i recomend everyone to use the async event listener and do some switches instead of the addevent interface, it's more elegant and feature-full
    Lansana Camara
    How can I specify a tolerance for Bitmap?
    Everything I try fails with a panic
    Carlos Armando
    hey, is there a way to convert from[]byte to C.MMBitmapRef ?
    go get -u -v github.com/go-vgo/robotgo
    github.com/go-vgo/robotgo (download)
    # github.com/go-vgo/robotgo/vendor/github.com/robotn/gohook
    In file included from ./event/pub.h:20:0,
    from ./event/goEvent.h:18,
    from go_work/src/github.com/go-vgo/robotgo/vendor/github.com/robotn/gohook/hook.go:22:
    ./event/../hook/x11/input_c.h:39:10: fatal error: xkbcommon/xkbcommon.h: No such file or directory
    #include <xkbcommon/xkbcommon.h>
    compilation terminated.
    | libxkbcommon | Library for handling xkb descriptions | 源代码包
    i+ | libxkbcommon-devel | Development files for the libxkbcommon library | 软件包
    | libxkbcommon-devel-32bit | Development files for the libxkbcommon library | 软件包
    i+ | libxkbcommon-x11-0 | Library for handling xkb descriptions using XKB-X11 | 软件包
    i+ | libxkbcommon-x11-0-32bit | Library for handling xkb descriptions using XKB-X11 | 软件包
    i+ | libxkbcommon-x11-devel | Development files for the libxkbcommon-x11 library | 软件包
    | libxkbcommon-x11-devel-32bit | Development files for the libxkbcommon-x11 library | 软件包
    i+ | libxkbcommon0 | Library for handling xkb descriptions | 软件包
    i+ | libxkbcommon0-32bit | Library for handling xkb descriptions | 软件包
    Hi, i have cross compilation error:
    $ GOOS=windows GOARCH=386 go build -o sendkey.exe sendkey.go
    # github.com/go-vgo/robotgo
    ../../github.com/go-vgo/robotgo/keycode.go:14:16: undefined: Map
    ../../github.com/go-vgo/robotgo/keycode.go:25:15: undefined: Map
    ../../github.com/go-vgo/robotgo/robotgo_mac_win.go:22:9: undefined: internalGetBounds
    ../../github.com/go-vgo/robotgo/robotgo_mac_win.go:31:12: undefined: cgetTitle
    ../../github.com/go-vgo/robotgo/robotgo_mac_win.go:45:2: undefined: internalActive

    How can i fix it?


    package main

    import (

    // SetupCloseHandler creates a 'listener' on a new goroutine which will notify the
    // program if it receives an interrupt from the OS. We then handle this by calling
    // our clean up procedure and exiting the program.
    func SetupCloseHandler() {
    c := make(chan os.Signal, 2)
    signal.Notify(c, os.Interrupt, syscall.SIGTERM)
    go func() {
    fmt.Println("\r- Ctrl+C pressed in Terminal")

    func main() {
    // Setup our Ctrl+C handler

    fmt.Println("\r- Press Ctrl+C to interrupt")

    // Run our program...
    for {
    min := 120
    max := 480
    sleep_secs := rand.Intn(max - min + 1) + min

    fmt.Println("\r- Type key and sleep: ", sleep_secs, "sec's")
    robotgo.TypeString("Hello World")
    time.Sleep(time.Duration(sleep_secs) * time.Second)