There are several projects that address this. The two most active ones, AFAIK, are
sikuli and AutoKey (a project I help support.)
I have not used sikuli, but it appears to be based on finding patterns on the screen and triggering actions based on them.
AutoKey allows the user to define trigger phrases and hotkeys which expand phrases (similar to a very powerful autocorrect feature) or run scripts written in Python3 that are only limited by the user's programming skills. It provides an API
for keyboard and mouse event generation. It also integrates with Xautomation which allows you to find a small image on the screen and move the mouse cursor to it.
I have been using AutoKey for many years and supporting it on our list. It's like a number of productivity tools: you can get by without it, but once you start using it, you'll wonder how you ever did without it.
AutoKey does not work with AutoHotKey definitions and scripts. They will have to be rewritten.
I did write a proof of concept bash script (available upon request) which translates AutoHotKey phrases into AutoKey phrases, but it is only a starting point and ignores most of AutoHotKey's options.
Since AutoKey scripts are written in Python3, it is also possible to call out to tools such as xdotool and wmctrl from within a script to provide additional functionality, but this is typically not necessary.
Although AutoKey scripts are written in Python, quite a lot can be accomplished with a very limited knowledge of Python. You don't need to be a fluent Python programmer for most purposes.
If you use a Debian-based distribution, please don't install the version of AutoKey provided by your distribution. Their AutoKey package is unmaintained and very old. Get a current version from us.
Edit: This was corrected in Debian testing and derivatives in 2020. They now offer the most current release.