0

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?

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
Rain
  • 37
  • 6
  • Related: https://github.com/micmonay/keybd_event https://stackoverflow.com/questions/1220820 I don't know of any ready made library for this functionality, but you can probably use translate a string into the appropriate keystrokes in keybd_event. Keep in mind that not every string character translates to a valid key combination – Hymns For Disco Feb 26 '21 at 02:32
  • 1
    You could use `bash -c "xsel -ib <<< 'my string'"` to copy "my string"` to the clipboard, and then `ctrl+v`. – Johnny Alpha Feb 26 '21 at 12:54

1 Answers1

0

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.

Olav Fosse
  • 128
  • 1
  • 5