AutoKey Text Expander for Linux

This is more than a “testimonial,” but it is that too. It’s an informational piece for anyone using Linux and wanting to save themselves tons of time by using keyboard shortcuts to enable their pc to do a lot of their typing for them. Feel free to assign the post elsewhere, if you wish.

Something I saw earlier today prompted me to do a search for the phrase “text expanders in Linux”. AutoKey seems to be the most advanced and most prominent text expander in the Linux community. I’m sure glad I found it when I first began to use Linux! There are some others, but they are far less user-friendly and helpful than AutoKey. So I decided to create this post about AutoKey, since using a text expander can be a time- and effort-reducing application that can save countless keystrokes, time, and effort when it’s set up for words and phrases which you frequently use but wouldn’t have to completely type every time you use them, if you were using a text expander. I suspect that people who aren’t using one have no clue how much wasted time and unnecessary frustration they would avoid if they were using one. My purpose in creating this post is to help show them that.

So I decided to create this post to provide relevant information about AutoKey. I believe that AutoKey needs to be easily found and recognized for its valuable contribution to the Linux community. Other posts I’ve seen date back to 2016. And I didn’t readily find any other posts about using AutoKey. Two of those posts mentioned AutoKey, but both authors were discouraged by it. I’ve also seen elsewhere that others said it couldn’t do scripts. It can, indeed, do scripts, but you have to tell AutoKey that it’s a script when you create it. And then you have to run the script when you want to use it. It can even record your keystrokes and mouse movements, and then play them back. So that could be useful when you need to do repetitive movements over and over. Just do it once, while recording it, and then let the recorded macro do it for you as many times as necessary.

From my experience of using AutoKey for at least 5-6 years now, I suspect those authors didn’t fully understand how to use AutoKey well. Creating the shortcut is slightly tricky , but I’ll covert hat in the Creating a Shortcut section below. AutoKey has been a tremendous help to me since I discovered it, after moving from Windows to Linux! I want you to have the experience of seeing how much time and frustration you can avoid by using AutoKey, if it makes sense to you to use it.

I constantly used the Smart Type Assistant app in Windows and really wanted to find a good replacement for it when I came to Linux. I’m really glad I found out about Linux, and now I can see how far better it is than using Windows, after many years of using Windows. I found a replacement in AutoKey. There are two versions available: autokey-gtk and autokey-qt. I normally use autokey-gtk. It’s been readily available in the many Debian/Ubuntu distros I’ve used or tried. I’ve never had a problem with it. I use it continuously through my days, for so many things.

I currently have 249 shortcuts saved, so you can see that I’m an avid user of this wonderful utility. If I notice that I’m starting to use something frequently, I’ll make a shortcut for it. I pick the first thing that pops into my mind as the shortcut, since it just makes sense to me to use that shortcut (like using la- for Los Angeles; the hyphen prevents the expander from playing out Los Angeles in any words that us “la” within the word). It can be words or phrases or even multiple paragraphs of text!

I use shortcuts for my first name, last name, street address, apt. number, city, phone number, words I commonly use, other peoples’ names I frequently use, phrases I often use, words I often mistype (so they are automatically corrected if I type them wrong), usernames I use, email addresses I use, various numbers I frequently use, urls, or generally any words and/or phrases I find myself typing frequently.

You can set up shortcuts that are automatically triggered as soon as you type them, or you can set up shortcuts that are only used if you type a hyphen after them. If I want to use a shortcut but not use it all of the time, I’ll put a hyphen (-) behind the shortcut, so I have to enter both the shortcut and the hyphen in order for it to be triggered. Also, when the shortcut is one or more letters that are commonly used or are often part of common words, I’ll add the hyphen so the shortcut isn’t triggered when I’m typing those letters or words. For example, I’ve set ar- as my shortcut for “autoresponder”. Since “ar” is a frequent part of other words, I need to type the hyphen only when I want the word “autoresponder” to play out, and not whenever “ar” is part of another word, like “part.” I just type those words as I’ve always done.

If you plan to use AutoKey, I suggest that you print out this post so you’ll have it handy when you’re setting up and using AutoKey. It’s a lengthy explanation, but I wanted to provide you here with the main details about how to use AutoKey so it’s easy to work with right away, without having to figure it all out on your own.

It’s really an easy app to use, once you learn some necessary steps you must take to set up your abbreviations and how to execute them. But it does require that you take those exact steps to ensure that it works for you. So learning about those steps ahead of time will save you frustration in having to figure it out by yourself.

There are some other options you can use with the program, but these below are the ones most people will need to know right away to begin using it effectively. Be sure to study the program as you’re working in it, to see if there are other features it has which would also benefit you.

Installing AutoKey

Before beginning to use AutoKey, you must first install it. You can use your distro’s software center or use the command line in a terminal to install it. To use the command line, open your terminal program and tell it whether you want the gtk or the qt version. To use the command line, enter: sudo apt install autokey-gtk (or autokey-qt) and then press the Enter key. Then type your sudo password, when prompted, to process the command. The terminal should install the application. When it’s done, close the terminal.

Setting AutoKey to Start up at Boot and Automatically save your changes

Once installed, if you know you’ll be using AutoKey frequently, you’ll want to add it to your autostart programs. You can do that by opening the running AutoKey program by using it’s shortcut, Super+k. If AutoKey isn’t running, then start it by using your menu system. Typing “auto” in your menu system’s search box is likely enough to display its name, AutoKey, so you can just press Enter or click on it to start up.

When AutoKey is open, go to its Edit menu and click on Preferences, at the bottom of the menu. Under the General tab, and under Application , click the check box beside “Automatically start AutoKey at login”. You can also click the checkbox beside “Automatically save changes without confirmation” so AutoKey won’t ask you to confirm that you want to save the changes, when you click “Save” at the upper left of the screen, below the menu bar, to save the new or edited shortcut, before you close AutoKey. Then click OK to save your changes and exit AutoKey, if you have nothing else to do there at that time. Of course, since it may be your first time to use AutoKey, that’s a good time to look through the menus to see what all is available and begin learning how to use AutoKey.

If you didn’t tell AutoKey to start itself at boot time, you can tell your distro to autostart AutoKey when you boot up. As mentioned above, you can do that by typing start in your distro’s search field. That will likely find your session startup program and let you enter AutoKey there. That usually involves entering the application’s name, AutoKey, and the location of the executable file. It’s a lot easier to do that in AutoKey, as described above, instead of having to do it manually.

Creating a Shortcut

Here are the basic steps for creating a shortcut.

Use the shortcut, Super+k, to open the running AutoKey program, or use your distro’s menu system to open it.

Type the name of the shortcut, including the hyphen, if you’re planning to use one, and press the OK button. (For example, you might use “la-” for “Los Angeles”, being sure to add the hyphen, since other words can contain the letters “l” and “a” together, such as “land”, and you don’t want “Los Angeles” automatically typed every time you start typing the word “land” or other affected words.)

Pressing the OK button in the step above automatically opened the area (on the right of the abbreviation) where you’ll enter the words you want automatically played out when you press the shortcut combination. To enter that text, click in the text area and select the instructional phrase, “Enter phrase contents”, to remove it, since it won’t automatically disappear when you enter that area. To remove it, position your mouse anywhere over that phrase and simply triple-click the left mouse button, which will select the entire phrase. Then press the Delete key to remove it. TIP: The triple-click technique can be used in any situation where you want to select a line of text. Triple-clicking is quicker and easier than swiping across the entire line.)[/B] [B]Then type the word or phrase that you want the shortcut to play out.

Then, below that area, click the “Set” button, beside “Abbreviations”. That will pop up the Set Abbreviations dialog box.

In the Set Abbreviations dialog box, click the “+Add” button at the bottom . That creates an empty text box area above, right below the word “Abbreviations”. Type the same character or phrase you used before (la-, in our example above), and press Enter, to enter the name of the abbreviation for the new shortcut. Then press the Tab key , which will take you into the section on the right of that abbreviation you just entered. If you used a hyphen, click the check box beside “Remove typed abbreviation” so the abbreviation is removed when playing out the shortcut. Also click the check box beside “Omit trigger character” so the hyphen disappears once you press the hyphen, when playing out the shortcut. When done, click OK.

Then be sure to click the “Save” button at the top left of AutoKey, below the menu bar, before you close the program, to save your changes. When you’re done, you can close the app. Closing it puts it back in the system tray, but leaves it running the background.

Using a Shortcut

To use AutoKey, ensure that you have AutoKey running. If AutoKey isn’t running, you’ll need to start it first. Again, simply typing “auto” in the search box of your menu system will likely find AutoKey and you can just press Enter to start it. If more than “AutoKey” shows up, select AutoKey and press Enter to start it.

To use an abbreviation, once AutoKey is running, put your computer’s insertion point (which usually looks like an “I”, frequently called an I-beam) where you want the abbreviation to be played out, and then type the abbreviation you assigned to the abbreviation (la-, in our example above). The text will expand exactly as you set it to do. (Hopefully you typed it all correctly. If not, this will be your opportunity to make a correction.)

If you notice a mistake, just go back into AutoKey (press Super+k to activate it, if you left it set that way), then find that shortcut, and then move your insertion into the right pane, beside that abbreviation, where the text to be expanded is located. Make any corrections and then click “Save” to save your changes. Then close AutoKey to the system tray again.

Though it takes a bit of careful attention to set up an abbreviation, it’s a quick and easy task to do, once you understand each step in the process. Taking a few moments to create an abbreviation and then remembering to use it when you need it, will save you time from then on out. Type it once, and let your computer type it from then on.

NOTE: You can use AutoKey for “boilerplate text” as well as for words and phrases. Your shortcut can include paragraphs of text, if needed, so you can simply type your shortcut and AutoKey will play out those paragraphs automatically for you, from then on. Imagine the wasted time you’ll save by typing it once and then letting your pc type it from then on!

Now you can appreciate the wasted time, effort, and needless frustration you’ll have saved yourself by letting AutoKey do a lot of your typing for you!

1 Like

Excellent app, thank you for sharing! This will indeed save a ton of time for address/phone number, email address, etc.