Website review
This review may include AI-generated content and is not individually verified. Domain, certificate and other facts come from the observed data on this page.
What is AutoKey?
AutoKey is a desktop automation tool for Linux that expands text abbreviations and runs scripts triggered by keyboard shortcuts. It is aimed at people who repeat the same phrases, form entries or key sequences and want to automate them locally rather than through a cloud service.
What it does
- Abbreviations: you define a short trigger that expands into a longer piece of text as you type.
- Scripted actions: AutoKey exposes a scripting API for keyboard and mouse control, so a hotkey can send key presses, click or move the pointer, and wait for input. The documented API includes keyboard functions such as
Keyboard.send_keys()andKeyboard.wait_for_keypress(), mouse functions such asMouse.click_relative()andMouse.move_cursor(), and a store for keeping values between runs. - Reusable settings: the documentation covers how settings are organised and how to "source" them onto a new computer, which matters if you maintain the same shortcuts across machines.
Who it suits
A support agent who types the same reply opening twenty times a day, a developer pasting boilerplate snippets, or someone with a repetitive data-entry workflow are the clearest fits. The scripting API also appeals to users comfortable writing small Python-style scripts who want conditional behaviour, not just static text expansion.
The trade-off is that it is a Linux desktop tool driven by configuration and scripts: useful power comes with setup effort, and shortcuts can collide with those in other applications. If you only need a handful of static text snippets, a simpler text expander may be enough; if you need key and mouse sequences, AutoKey's API is the reason to choose it.
A practical next step is to list your five most repeated actions, then check whether each is plain text (an abbreviation) or a sequence of keys and clicks (a script). That split tells you how much of AutoKey you will actually use. The official documentation at AutoKey 0.96.0 documentation is the place to confirm current behaviour before relying on a specific function.
How do I set up AutoKey abbreviations to expand text as I type?
Abbreviations in AutoKey are set up as "Phrases" that fire when you type a short trigger string, then expand into longer text. The official documentation covers the concept under "Adding Abbreviations," and the scripting side through the Autokey API, so you can start with plain text expansion and grow into dynamic scripts later.
Basic setup
- Open the AutoKey main window and select the folder (or create one) where the phrase should live.
- Add a new Phrase and give it a name you'll recognize.
- In the phrase's content area, enter the text you want inserted.
- Set the abbreviation (the trigger) in the phrase's abbreviation field.
- Save, then type the abbreviation in any text field to test the expansion.
A practical first example: set the abbreviation ;sig to expand into your name, title and contact line. Choose triggers that don't collide with normal words—leading punctuation like ; or // is common because it rarely appears in prose.
Choosing between plain phrases and scripts
| Use case | Phrase type | Trade-off |
|---|---|---|
| Fixed boilerplate, signatures, canned replies | Plain text phrase | Simplest; no logic, but no flexibility either |
| Inserting today's date, selected text, or clipboard content | Script phrase | More powerful; requires a little Python and testing |
| Multi-step actions (type text, press keys, click) | Script using the Keyboard and Mouse APIs | Handles complex workflows; harder to debug and more fragile across apps |
The documentation's API reference lists Keyboard.send_keys(), Keyboard.fake_keypress() and the Key constants for scripted phrases, plus Mouse methods if a phrase needs to click or move the cursor. A concrete script use: a phrase that reads the current selection and wraps it in quotes, or one that inserts a timestamp—both are cases where plain text can't do the job.
Things worth checking
- Trigger uniqueness: two phrases with overlapping abbreviations can produce surprising results; keep triggers distinct.
- Application context: if an expansion only makes sense in one program, scope the folder or phrase accordingly rather than firing it everywhere.
- Testing: try each abbreviation in a scratch document before relying on it in email or a code editor.
If you want to compare approaches, the AutoKey project pages at GitHub host the source and issue tracker, and general desktop-automation discussion often appears alongside tools like AutoHotkey (Windows-only, different scripting model). For a next step, pick your three most-repeated snippets, convert them to plain phrases first, and only move to script phrases where you need dynamic content.
How can I write a Python script in AutoKey to automate keyboard and mouse actions?
AutoKey scripts are Python programs that run inside AutoKey and call its own Keyboard and Mouse APIs to send keystrokes and control the pointer. The documentation lists the two main pieces you'll use: Keyboard methods such as send_key(), send_keys(), press_key(), release_key(), fake_keypress() and wait_for_keyevent(), and Mouse methods such as move_cursor(), click_relative(), click_absolute(), press_button(), release_button(), and scroll_up()/scroll_down(). Keys are referenced through the Key class (for example Key.ENTER, Key.TAB, Key.CONTROL, Key.F5), and mouse buttons through Mouse.Button.
A minimal pattern, based on the documented API names:
# Type text, then press Enter
keyboard.send_keys("hello world")
keyboard.send_key("<enter>")
# Hold Ctrl and tap C
keyboard.press_key("<ctrl>")
keyboard.send_key("c")
keyboard.release_key("<ctrl>")
# Move the mouse and click
mouse.move_cursor(400, 300)
mouse.click_relative(0, 0, mouse.LEFT)
Treat this as a sketch: check the exact argument order and key-string syntax in the API pages before relying on it, since the docs define each method individually.
Practical choices that affect reliability
send_keys()vs.fake_keypress():send_keys()is the general way to type text or key names;fake_keypress()simulates a single key press at a lower level. Usesend_keys()for normal text entry and reach for the lower-level calls when an application ignores synthesized typing.send_mode:KeyboardexposesSendModevalues such asKEYBOARD,CB_CTRL_V,CB_CTRL_SHIFT_V,CB_SHIFT_INSERTandSELECTION. These reflect different ways of delivering text (typing versus clipboard-based pasting), which matters in apps that block synthetic keystrokes or where pasting is faster for long text.- Timing: scripts that press and release modifier keys must always release them, or the desktop can be left with a stuck Ctrl or Shift. Wrap risky sequences in
try/finally. - Coordinates:
click_absolute()depends on screen position and breaks if windows move;click_relative()andmove_relative()are more robust for repeatable workflows.
A concrete scenario
Suppose you paste the same block of formatted notes into a ticket system several times a day. A script could move the cursor to the notes field, paste via a clipboard send mode, then press a shortcut to submit. For a data-entry clerk working in one fixed application, absolute clicks are fine; for someone whose window layout changes between monitors, relative positioning plus keyboard shortcuts is the safer design.
As a next step, open the "Common actions" and "Introduction to Autokey" pages in the same documentation to see how scripts are attached to phrases, hotkeys, or folders, then test each API call in isolation before combining them.
How do I move my AutoKey settings and phrases to a new computer?
AutoKey documents a dedicated "source" process for moving settings to a new computer, so that is the intended path rather than copying folders by hand. The likely flow is to export or collect your existing configuration on the old machine, then import or "source" it on the new one so phrases, abbreviations and settings come across together. Because the documentation treats this as a distinct topic, check that page first for the supported method and any caveats about paths or versions.
A practical sequence
- On the old machine, locate the source/export option described in the docs and produce a copy of your settings.
- Install AutoKey on the new machine, ideally the same version family as the old one.
- Use the import/source step on the new machine, then test a few phrases and abbreviations.
- Keep the exported copy until you have confirmed everything works, since it doubles as a backup.
What to watch for
- Phrases tied to scripts or external files: a phrase that calls a script or reads a file path may import but fail if the target does not exist on the new machine. Test those specifically.
- Keyboard shortcuts that clash: a shortcut that was free on the old system may be taken by another application on the new one.
- Version differences: settings written by a newer AutoKey may not load cleanly in an older release, so match versions where possible.
If the official page does not cover your case, the project's user community is the next place to ask; the documentation at AutoKey 0.96.0 documentation is the authoritative starting point for the exact menu names and steps.
How do I choose which keyboard send mode AutoKey uses when pasting text?
Choose the send mode by matching it to the target application and to what you need the pasted text to do. AutoKey's keyboard API exposes several modes through Keyboard.SendMode: KEYBOARD, CB_CTRL_V, CB_CTRL_SHIFT_V, CB_SHIFT_INSERT, and SELECTION. In practice:
KEYBOARDtypes the text as simulated keystrokes. It is the fallback when clipboard-based pasting doesn't work, but it is slower for long text and can trigger shortcuts or autocomplete in apps that react to individual keys.CB_CTRL_Vplaces the text on the clipboard and sends Ctrl+V. This is the usual choice for ordinary text fields and is fast for long phrases.CB_CTRL_SHIFT_Vuses the Ctrl+Shift+V paste shortcut. Reach for it in terminals and other apps where plain Ctrl+V does something else.CB_SHIFT_INSERTuses Shift+Insert, a classic paste shortcut that some older or nonstandard applications honor when Ctrl+V does not.SELECTIONpastes through the current selection mechanism, useful in environments where clipboard shortcuts are intercepted.
A simple decision path: try CB_CTRL_V first for normal text entry; switch to CB_CTRL_SHIFT_V for terminal windows; try CB_SHIFT_INSERT if Ctrl-based paste fails in a legacy app; and use KEYBOARD only when clipboard access is unavailable or blocked, accepting that it is slower and more prone to side effects. If you are unsure, test the same phrase in the specific application you care about and watch whether the text arrives intact and whether any menus or shortcuts fire unexpectedly.
For the exact behavior of each mode and how to set it in your script, see the keyboard API reference in the AutoKey 0.96.0 documentation.
How can I use AutoKey's Store API to save values between different scripts?
AutoKey's Store API lets one script leave a value behind and another script read it later, so you can split a workflow across separate scripts without hard-coding the shared value in each one. The API exposes two scopes: per-script values and global values.
Choosing a scope
| Scope | Methods | Use when |
|---|---|---|
| Script-local | Store.set_value(), Store.get_value(), Store.has_key(), Store.remove_value() |
The value belongs to one script and should not leak into others |
| Global | Store.set_global_value(), Store.get_global_value(), Store.remove_global_value() |
Several different scripts or phrases need to share the same value |
The documentation lists these methods in the Store API section alongside a has_key() check, which is the practical way to test whether a value already exists before reading it.
A concrete pattern
Say you have one script that captures a project name and another that pastes it into a form. The first script writes the value with Store.set_global_value(), and the second reads it with Store.get_global_value(). Because the value is global, any other phrase or script can also read it, which is the point of choosing that scope over the script-local one.
Practical guidance
- Check before reading. Use
has_key()so a script can fall back to a default or prompt the user when nothing has been stored yet. - Clean up when done. Call the matching
remove_*method once a value is no longer needed, so a stale entry does not surprise a later run. - Prefer the narrowest scope. Use script-local storage unless you specifically need to share across scripts; global keys are easy to overwrite by accident.
- Treat stored values as simple data. They are convenient for passing strings and flags between scripts, but they are not a substitute for a real configuration file or database when you need structure or durability.
A useful next step is to open the Store API page in the AutoKey documentation and read each method's description in order, then write a two-script test: one that stores a value and one that reads and removes it.
User reviews (0)