AutoKey as a Linux alternative to PyAutoGUI
Updated
Our verdict
AutoKey is a strong replacement for PyAutoGUI if your goal is desktop automation via scripts and hotkeys, rather than low-level input simulation for testing. It handles mouse clicks, keyboard input, and screen coordinates well on X11 and Wayland. However, it is not a direct library drop-in; you write Python scripts within its framework instead of importing a module. It is ideal for users who want to automate repetitive office or development tasks without writing standalone executables. If you need to build a custom application that programmatically controls inputs with minimal latency, stick with a Python library like pynput or xdotool via subprocess, as AutoKey adds a layer of abstraction for global hotkeys and text expansion.
- License
- GPL-3.0
- Price
- Free
- Latest version
- 0.96.0
- Rating
- —
What works the same
- Both use Python as the primary scripting language for automation logic.
- Both can simulate mouse movement, clicks, and keyboard keystrokes.
- Both operate directly on the Linux desktop environment (X11/Wayland).
- Both allow for programmatic control of input devices without a GUI for execution.
What is different
- PyAutoGUI is a lightweight Python library for embedding in apps; AutoKey is a standalone desktop application with a GUI for managing scripts.
- AutoKey adds features like text expansion, clipboard management, and global hotkey registration that PyAutoGUI lacks.
- PyAutoGUI offers direct, low-level access to input events for high-frequency or precise testing; AutoKey is better suited for event-driven or scheduled tasks.
- AutoKey requires installing a system package and running its daemon; PyAutoGUI is installed via pip and runs within your Python environment.
Opening your PyAutoGUI files
There is no direct file format compatibility between PyAutoGUI scripts and AutoKey. PyAutoGUI scripts are standard Python files (.py) that import the library. AutoKey uses its own internal script structure, typically stored in its configuration directory. You cannot simply open a PyAutoGUI .py file in AutoKey and expect it to run without modification, as the import statements and execution context differ. You will need to rewrite the logic to fit AutoKey's scripting environment.
Switching from PyAutoGUI to AutoKey, step by step
- Install AutoKey from your distribution's package manager (e.g., apt install autokey-gtk).
- Open the AutoKey GUI and create a new script group or script.
- Rewrite your PyAutoGUI logic, replacing imports with AutoKey's provided API objects (mouse, keyboard, screen).
- Test the script manually using the AutoKey 'Run' button before assigning hotkeys.
- Assign global hotkeys or triggers to the script if you need event-based activation.
- Configure AutoKey to start on login if you need persistent automation.
Key features of AutoKey
- Python-based scripting engine
- Global hotkeys and key sequences
- Text expansion and clipboard management
- Script grouping and tagging
- Integration with X11 and Wayland
- Run scripts on startup or on demand
How to install AutoKey on Linux
sudo apt install autokeysudo apt install autokeysudo dnf install autokeyFrequently asked questions
Can I use AutoKey to test my application's UI?
Yes, but it is less ideal than PyAutoGUI for this. AutoKey is designed for user-facing automation. For automated testing where you need precise, low-latency, and headless control, a pure Python library like pynput or xdotool is often better suited.
Does AutoKey work on Wayland?
Yes, AutoKey supports Wayland, though some advanced features like exact mouse coordinate simulation may behave differently depending on the compositor. It generally works well for standard click and type operations on modern Wayland sessions.
Is AutoKey free?
Yes, AutoKey is free and open-source software licensed under GPL-3.0. It is available in the official repositories for Debian, Ubuntu, and Fedora.