AutoKey – Nifty text expander for Linux

One thing I’ve been missing on the netbook[1] is an equivalent of ShortKeys Lite on Windows or TextExpander on Mac OS X. Both automagically expand a short code to a larger piece of text. I find this quite useful, and I’ve been missing it while using Ubuntu.

So, I did some searching and found quite a lot of people looking for much the same thing, but not that many answers. But a little more searching did turn up a few possibilities. The first was Snippits, referred to in a Lifehacker article, and with rather more detail in a Ubuntu Forum thread. So, I gave it a try.

Well, it sort of worked. It’s a wee bit faffy, in that each block of text you want to expand has to be saved as a separate text file, and it was a wee bit slow some of the time. But the big problem for me was that it seemed to be limited to around 256 characters. And as some of the blocks of text I need to insert are longer than that, it clearly wasn’t going to do the job for me. If your needs are different, it might be just the thing, so don’t let me put you off giving it a try.

The next thing I tried was AutoKey. Now if you’re not comfortable with a bit of fiddling, you might not like this – there’s no automagic installation of the package or its dependencies here – the download is a compressed archive which you need to unpack in a folder under your home folder. Not a major operation – the usual archive tools on Linux make it simple enough to unpack to a location of your choice (not hugely different from the equivalent tools on Windows or Mac OS X, really). But before you can use it, you’ll need to install some packages that it needs – normally, an installation would go and find these for you, but this time you’ll need to install them manually. There’s a helpful list on the download page, but you can just copy this line of code and run it from your terminal:

sudo apt-get install python-xlib python-gamin python-notify python-configobj

Now you’ll want to get AutoKey to start automagically when you log on. Assuming you’re using the standard Gnome desktop on Ubuntu (and it’ll be somewhere similar in other distributions and/or desktops), go to Preferences, then Sessions, and click the Add button on the Startup Items tab. Type in a friendly name in the Name box, then click the Browse button to find where you saved the autokey.sh file. Add a comment if you feel like it, then click the Save button.

Now close everything and log out and in again. When you get back in you should see a new icon in your tray thingy area. Right-click on it to get a pop-up menu. Make sure Enable expansions is ticked, then click on Edit abbreviations file.

If you have a look at the file, you should be able to work out what to do from the examples. You’ll probably want to delete some of them, and add your own. There are also some settings towards the bottom of the file, which you may want to play with. When you save the file, your abbreviations are instantly reloaded into AutoKey, and they’ll work immediately.

So far, it seems to do exactly what I want, and I’m quite happy with it. I’ve written this post in the hope it’ll help people find the answer I was looking for. Hope it helps.

If you try it and have any problems, you’ll need to refer to the developer’s support forum – I know far too little about Linux to offer any useful suggestions.

[1] Apparently the once-great company Psion have fallen to the level of litigation and are threatening people who use the term “netbook” as a generic term for particularly small notebook/laptop computers, rather than for their own, largely forgotten products of that name. Silly Psion….

3 thoughts on “AutoKey – Nifty text expander for Linux

  1. frann

    This is a great help, but for people with even less linux nouse than me, you might add in the commands to make autokey.sh executable before they restart. I was wondering why it didn’t work, and realized this was probably it.

    cd to the folder where the file is
    sudo chmod +x autokey.sh

  2. Joel Zehring

    Thanks for recommending Autokey. It does exactly what I wanted it to do, and a little bit more. Looking forward to exploring all the ways I can use this application.

    BTW, the developers moved the project to Google Code and released a PPA:

    ppa:cdekter/ppa

  3. Pingback: Die kleinen Nettigkeiten, die das Schreiben erleichtern können

Comments are closed.