Search code examples
linuxgoautohotkeygo-packages

Is there a way to send strings as keystrokes like autohotkey?


I moved from Windows to Linux and want to use AutoHotKey. I've tried using autokey but I really didn't like it. Is it possible to use golang to simply send strings as keystrokes to other programs?


Solution

  • The github.com/micmonay/keybd_event package provides an API for simulating keystrokes cross-platform, I.e on Linux, MacOS and Windows.

    The API does not however provide a way of mapping strings to a sequence of keypresses. That you will have to implement yourself or alternatively, if you want us to help, describe how you would like the strings to be mapped to keypresses.