AutoHotkey on Linux: Why It Doesn't Work and What to Use Instead

Quick answer: AutoHotkey has no native Linux build and never has — it's built directly on Windows-specific APIs (window messages, low-level keyboard hooks, DLL calls into Win32) that don't exist on Linux, so there's nothing to "port" without rebuilding an entire compatibility layer underneath it. On Linux, the closest AutoHotkey (AHK) equivalents depend on what you used it for: AutoKey (free, Python-scripted, X11 only), xdotool (a command-line primitive several other tools are built on, also X11 only), Espanso (free, cross-platform, YAML config, experimental Wayland support), and for remapping keys, keyd or kanata, which work on Wayland too. For text expansion and hotkeys specifically — not full window automation — Lightning Assist covers that ground with a GUI, on X11 and native Wayland — text expansion is free, Pro is $5.99/month.
Disclosure: we make Lightning Assist, a paid text expander, so AutoHotkey is a competitor of ours. AutoHotkey is free and open source, and we've tried to describe it accurately — including the things it does better than we do.
Updated 19 November 2026: added keyd and kanata for key remapping, Espanso 2.4.1, and a correction about AutoKey and xdotool under XWayland.
If you've searched for "AutoHotkey for Linux" and landed on a project page that never shipped a native Linux build, you're not missing an installer — it doesn't exist. Here's the technical reason why, and what actually works instead.
Why AutoHotkey Doesn't Run on Linux
AutoHotkey isn't Windows software that simply hasn't been ported yet. Its entire design sits on top of Windows-specific mechanisms:
- Low-level keyboard and mouse hooks (
SetWindowsHookExin the Win32 API) to intercept every keystroke system-wide before it reaches the focused app. - Window messages (
SendMessage/PostMessage) to read and control other applications' windows and controls directly. DllCall, AutoHotkey's mechanism for calling arbitrary Windows DLLs and COM objects — how advanced scripts reach into Windows internals.
None of these have a Linux equivalent. X11 and Wayland don't use Win32 messages, don't expose SetWindowsHookEx-style global hooks, and have no DLL/COM layer to call into. Reproducing AutoHotkey's actual behavior on Linux wouldn't mean recompiling the same source for a new target — it would mean building an entire Windows-API compatibility layer underneath it, which is exactly what Wine already does for arbitrary Windows programs. In practice, if you want the actual AutoHotkey.exe running on Linux, running it under Wine is the closest you'll get, with the usual caveats: compatibility depends on which Win32 APIs a given script calls, and neither the AutoHotkey project nor Wine officially certifies the combination.
Worth knowing if you're evaluating AHK at all right now: AutoHotkey v2 is the actively developed version — v1.1 reached end-of-life in March 2024 and is no longer maintained, so any new scripts (Windows or Wine) should target v2 syntax. See the official AutoHotkey documentation for current requirements.
💡 Only need text expansion and hotkeys, not full window automation? You don't need Wine or a compatibility layer at all — Lightning Assist runs natively on Linux. Try free for 14 days → — no credit card.
What Actually Works on Linux
AutoKey — Python Scripting, X11 Only
AutoKey is the closest thing Linux has to an AutoHotkey equivalent: text expansion (phrases that expand on a trigger) plus Python scripting for anything more complex — clipboard manipulation, window-specific rules, multi-step automation.
Its real state, honestly: Chris Dekter created AutoKey in 2008 on Python 2; that branch reached end-of-life in 2012. A contributor going by Guoci revived it as a Python 3 fork starting in January 2014, and it's maintained today by Thomas Hess under the GPLv3 license. It isn't abandoned — the GitHub repository shows continued commits and beta activity — but it also isn't fast-moving software with frequent releases; the most recent stable release is still 0.96.0, from June 2022. It ships a GUI (GTK3 or PyQt5, depending on build) for managing phrases, which is more than Espanso offers, though the interface is dated rather than polished.
The platform limitation that matters most: AutoKey's own README is explicit about it — "This is an X11 application and, as such, will not function correctly when Wayland is in use instead of Xorg." If your distro defaults to a pure Wayland session with no XWayland, AutoKey does not work.
xdotool — A Building Block, Not an App
xdotool isn't a text expander on its own — it's a command-line tool (and C library) for simulating keyboard/mouse input and manipulating windows on X11, and several other Linux automation tools are built on top of it, including some in our Linux text expander roundup. If you're comfortable writing shell scripts and binding them to keypresses via your window manager, xdotool type and xdotool key can replicate basic AHK hotstrings — you're just writing the glue yourself.
Like AutoKey, it's X11-only. Its own documentation warns plainly that on Wayland, "typing, window searching, and many other functions of xdotool do not work," and points to ydotool or dotool as Wayland-native alternatives — though neither replicates AHK's ecosystem of hotstrings and GUI configuration; they're lower-level primitives, same as xdotool.
Espanso — Free, Cross-Platform, Not Windows-Specific
Espanso is a genuinely different tool from AHK: it's a dedicated text expander rather than a general automation language, it's free and open source, and — unlike AutoKey and xdotool — it runs on Windows, macOS, and Linux from the same YAML-based configuration. If what you actually used AHK for was typing shortcuts rather than window automation, Espanso is a more direct replacement than AutoKey.
Espanso's Wayland support has been improving: version 2.4.0 (July 2026) added a WaylandAppInfoProvider for wlroots-based compositors (Sway, Hyprland, labwc, Wayfire) and fixed installation on Fedora Wayland, on top of its existing evdev/uinput-based injection approach, and 2.4.1 (September 2026, the current release) added the Linux desktop file and icon. It's still officially experimental rather than guaranteed-stable, and there's no visual snippet editor — snippets live in YAML files (it does have a search bar for inserting them). For the full rundown, see our Espanso troubleshooting guide and Espanso vs. Lightning Assist comparison.
keyd and kanata — Key Remapping, X11 and Wayland
A lot of AHK scripts are only remaps: Caps Lock as Escape, a navigation layer on the home row, a key that sends a shortcut. For that, two Linux tools work below the display server, so they don't care whether you run X11 or Wayland:
- keyd describes itself as "a key remapping daemon for linux". It runs system-wide and remaps keys through the kernel's evdev/uinput input layer, configured in a text file. It's MIT-licensed; the latest release is 2.6.0 (December 2025). Its application-specific remapping currently ships with support for X, Sway and GNOME on Wayland.
- kanata is a cross-platform keyboard remapper for Linux, macOS and Windows (layers, tap-hold keys), also configured in a text file and LGPL-3.0-licensed; the latest stable release is 1.12.0 (July 2026). On Linux it needs access to the input devices, which its README handles with
sudoor a documented group setup.
Neither is a text expander with a snippet library, and neither automates windows. They cover the remapping half of AHK, and they are the closest thing on this list to AHK's CapsLock::Esc one-liners.
Where Lightning Assist Fits — and Where It Doesn't
To be direct about scope: Lightning Assist does not do window automation, UI scripting, or general-purpose macros — the things AHK is genuinely built for and does better than anything on this list. If you're automating window layouts, scripting multi-step dialogs, or writing conditional logic against other apps' UI, keep using AutoKey (on X11) or Wine-hosted AHK.
What Lightning Assist covers is the other half of what most people actually use AHK for day to day: text expansion and hotkeys, on Linux, with a GUI instead of a script or config file.
- Native Linux app — ships as a
.debfor Debian/Ubuntu systems and an AppImage for Fedora, Arch and most other 64-bit distributions. The AppImage runs without installation; on Wayland, granting keyboard access asks for your password once. - Runs on X11 and native Wayland — on Wayland it reads and injects keys through the kernel's evdev/uinput layer after a one-time "Grant access" step inside the app (GNOME, KDE and wlroots compositors), and it decodes your active layout, so QWERTZ, AZERTY and Dvorak triggers land correctly. It is the same class of backend Espanso uses, without the manual
setcap. - Inline expansion by default — type your trigger, it expands inline, no hotkey press required. See all activation modes →
- AI commands (rewrite, enhance, translate selected text) and push-to-talk voice-to-text — both absent from AutoKey, xdotool, and Espanso. Voice-to-text on Linux →
- Cross-platform sync — the same snippet library follows you to Windows or Mac, unlike AHK scripts or AutoKey phrases, which are single-machine by default.
Try Lightning Assist free for 14 days on Linux — no credit card required.
AutoHotkey Feature → Linux Option
| What you used AHK for | Closest Linux option |
|---|---|
| Text expansion / hotstrings | Lightning Assist (GUI) or Espanso (YAML) |
| Simple hotkeys | Lightning Assist, AutoKey, or your window manager's keybindings |
| Key remapping (Caps Lock → Esc, layers) | keyd or kanata (X11 and Wayland) |
| Window automation, UI scripting | AutoKey (X11 only) or Wine-hosted AutoHotkey |
| Shell/script-triggered actions | AutoKey (Python) or Espanso (shell extension) |
Running your actual .ahk scripts |
Wine — hit or miss, especially for AHK v2 |
The Bottom Line
AutoHotkey isn't coming to Linux natively, and it isn't a porting backlog issue — its design depends on Windows APIs Linux doesn't have. If you need AHK's full scripting and window-automation depth, AutoKey (on X11) or Wine are your real options, with the platform caveats above. If what you actually used AHK for was expanding text and firing hotkeys, Lightning Assist replaces that half with a native Linux GUI, no YAML or Python required, and adds AI commands and voice typing AHK never had.
See also our AutoHotkey alternatives across all platforms and Lightning Assist vs. AutoHotkey.
Frequently Asked Questions
What is the AutoHotkey equivalent for Linux?
There isn't a single one, because AHK does several jobs. For text expansion, Espanso (YAML) or Lightning Assist (GUI). For key remapping, keyd or kanata. For scripted window automation, AutoKey on X11. To run your existing .ahk files, Wine. The table above maps each AHK use to its Linux option.
Can I run my existing .ahk scripts on Linux?
Only through Wine, and only partially. Wine translates Win32 API calls to their Linux equivalents, so simple scripts (hotstrings, basic hotkeys) have a reasonable chance of working, while scripts calling deeper Win32/COM APIs or relying on precise window-message timing are more likely to break. Test your specific script rather than assuming it will work.
Is AutoKey a full AutoHotkey replacement on Linux?
For window automation and scripted logic, yes in spirit — Python replaces AHK's scripting language, and AutoKey can manipulate windows and the clipboard similarly. For text expansion specifically, AutoKey is capable but its interface is dated compared to a dedicated text expander, and it's X11 only, so it won't run at all on a pure Wayland session.
Does anything here work on Wayland without XWayland?
Espanso has the broadest Wayland coverage of the free options — its evdev/uinput backend runs on GNOME, KDE, and wlroots compositors (after a one-time setcap permission grant), though Espanso itself still calls this support experimental. AutoKey and xdotool are X11 tools: on a Wayland session they can at best reach apps that run through XWayland, and their own READMEs say they won't work correctly on Wayland. keyd and kanata remap keys below the display server, so they work on Wayland. Lightning Assist runs natively on Wayland through the same evdev/uinput layer, with the permission granted from inside the app instead of a manual setcap.
Is there an AutoKey alternative that works on Wayland?
For text expansion, Espanso (experimental Wayland support, YAML config) or Lightning Assist (GUI, native Wayland). For remapping keys, keyd or kanata. For AutoKey's Python window scripting there is no direct Wayland equivalent; ydotool and dotool can simulate input on Wayland, but they are low-level primitives like xdotool, not a scripting environment.
What's the actual difference between AutoKey and Espanso?
AutoKey is a general automation tool (Python scripting, window-specific triggers, clipboard control) that happens to include text expansion. Espanso is a dedicated text expander (YAML-based) that happens to support shell-command extensions. If your AHK use was mostly text shortcuts, Espanso is the more direct replacement and also runs on Windows and Mac; if you need real scripting and window control, AutoKey is closer to AHK's actual scope, Linux/X11 only.
Sources
- AutoHotkey official documentation — current v2 docs and requirements
- AutoHotkey — Wikipedia — version history, v1.1 end-of-life date
- AutoKey on GitHub — README, platform support, releases
- AutoKey — Wikipedia — project history and maintenance
- xdotool on GitHub — Wayland compatibility notes
- Espanso — official site, v2.4.0 and v2.4.1 release notes
- keyd on GitHub — README, releases
- kanata on GitHub — README, releases