If you do a lot of typing it could be useful to have a program that can easily manage your custom shortcuts, create and test them.

For all these things you can use the program autokey.

AutoKey is a desktop automation utility for Linux and X11. It allows you to manage collection of scripts and phrases, and assign abbreviations and hotkeys to these. This allows you to execute a script or insert text on demand in whatever program you are using.

AutoKey features a subset of the capabilities of the popular Windows-based AutoHotkey, but is not intended as a full replacement. For a Linux-based implementation of AutoHotkey, see IronAHK. AutoKey’s GUI features a number of concepts and features inspired by the Windows program PhraseExpress.

Features of AutoKey include:

  • Python scripting engine allows you to automate virtually any task that can be accomplished via the keyboard and/or mouse
  • Built-in code editor with autocomplete and calltips
  • Scripts are plain Python files that can be edited in any text editor
  • Similarly, phrases are stored as plain text files
  • Create collections of phrases/scripts in folders, and assign a hotkey or abbreviation to the folder to display a popup menu
  • Regular expressions can be used to filter windows by their title or class, to exclude hotkeys/abbreviations from triggering in certain applications
  • Scripts, phrases and folders can be attached to the notification icon menu, allowing you to select them without assigning a hotkey or abbreviation


On Ubuntu there are 2 packages on the main repository: autokey-gtk and autokey-qt, so depending on your Desktop Environment you can choose which frontend install, I use XFCE so I’ve installed the GTK version with the command:

sudo apt-get install autokey-gtk

Basic Usage

When a trigger previously defined is detected by Autokey, it can do three different actions:

1) A script is activated
2) Some text is inserted at the cursor position
3) A pop-up menu is displayed allowing a script or phrase to be activated by selecting it.

Let’s do an example with the trigegr defined by default.

Start autokey from the applications menu (usually it’s located under Accessories -> AutoKey) or just type in a terminal


Now open a text editor, such as gedit.
We can activate the popup menu of hotkey with the default keys <ctrl> + <F7>, you should see something like this:


You can see the popup windows where you can click on:

1- Addresses
2- First phrase
3- Second phrase
4- Third phrase

Clicking on 1- Addresses you’ll have the text associated with this hotkey printed in gedit:


The same result could be achieved typing the shortcut associated with this text, in this case adr.

Customise shortcut Keys in AutoKey

Probably you have noticed that now you have a small A in your system-tray, clicking with the left mouse button will bring up the configuration window of autokey:


From this image you can see that using the keys <ctrl> + <F7>, will bring up the “My Phrases” submenu.

From here you can easily add and change the shortcut keys and the result that they will trigger.


This is just a small introduction to the world of autokey, the possibility with this software are many and interesting.
You can set up the same hotkeys for different Desktop Environments, or you can use, or write, complex python scripts that once triggered do a lot of things for you.


How to Customize Shortcut Keys for Any Linux Application

One of the more annoying problems with Linux has always been the lack of AutoHotkey support, so you couldn’t customize your shortcut keys—but now with the open source application AutoKey, you can do that and more.

AutoKey is a desktop automation utility that lets you manage blocks of text and use abbreviations and hotkeys to save yourself time while typing—but you can also use it to remap hotkeys in applications. For instance, if your favorite application used Ctrl+Q to quit and you didn’t want it to, you could remap that key using AutoKey.

The Scenario

For our test scenario today, I’m going to remap the Ctrl+T key combination to Alt+T instead. Why, you ask? The Ctrl+T shortcut key is used in every browser to open a new tab, but since I use Google Chrome and like to open new tabs constantly to search, the Alt+T shortcut key is a lot easier for me to hit without moving my hands from the front row.


To accomplish this task, we’ll use the amazing AutoKey tool, which is a lot like AutoHotkey on Windows, except it’s made for Linux and is capable of using Python scripts.

Installing AutoKey

You’ll want to open up the Synaptic Package Manager and do a quick search for autokey, check the box, and then install the package. You could also install it using the apt-get command like this:

sudo apt-get install autokey

Remapping Shortcut Keys with AutoKey

Once you’ve got the utility installed, you can open up the configuration through the tray icon and create a New Phrase. The name on the left-hand side doesn’t mean anything, I just like to name them according to the hotkey that I’ll be assigning.

Use the Set button next to Hotkey to assign the hotkey you want to use, click the modifier key—in this case, I’m assigning Alt, and then click the Press to Set button and the key you want to use. For my example, I’m using Alt+t, and you’ll notice the character is lowercase, which is important—if you pressed Shift+T there, AutoKey would get confused.

Once that’s done, you can put the following into the text box:


Click the save button, and you’re done. Now you can open up your browser and use the Alt+T combination instead of Ctrl+T, and it should open up a new tab.

How does this work? When you press the Alt+T hotkey that you’ve assigned, AutoKey sends the keystrokes to the currently active application, and since the keystrokes in this case are Ctrl+T, Google Chrome assumes that you pressed the shortcut key for a new tab, and responds accordingly.

Filtering by Window

The only problem is that the shortcut key now is activated for all windows. To fix this, we can setup a window filter using the Set button, and then type in something similar to this:


You might be wondering what the .* is all about—this filter uses regular expressions to find the window title, so you’ll need to use .* to match any characters that aren’t specified, including the space in this case. Note: You could use a single period character to represent a space if you want.

Using Special Keys in AutoKey

When you’re creating a new phrase, you can use the following special codes to simulate pressing one of the special keys. There’s actually a much bigger list of special keys, but these are probably the most important ones you’ll need to use:

  • <ctrl>
  • <alt>
  • <escape>
  • <tab>
  • <shift>
  • <super>  = Windows Key
  • <enter>

Combining Keys

If you want to combine together a number of keys, you’ll use the + character, like this:


If you needed to actually insert a + symbol, you’d need to use <np_add> instead.

AutoKey Rocks!

There’s any number of uses for this technique besides just remapping shortcut keys—you could automate a series of keystrokes to perform a task, for instance. The possibilities are endless—but what would you use it for?