Friday, October 1, 2010

Autokey: Make Your Own Keyboard Shortcuts In Linux

Few days ago, we discussed the usefulness of Spark and how it enables you to create custom shortcut keys in Mac. Alternatively, in Windows, we can use the popular AutoHotKey to create custom shortcuts. So what about Linux? Autokey is probably the best answer.
AutoKey is a desktop automation utility for Linux and X11. It allows you to create scripts and assign hotkeys to these scripts, allowing you to execute them on demand in whatever program you are using.

Compatibility with various distro and keyboard layout

Personally I did not test it on all the Linux distro and all the different keyboard layout. However, according to the developer of Autokey:
The core part of AutoKey is sending and receiving keyboard events via the X server. It supports multiple X interfaces and should therefore be compatible with virtually any version of Linux running an X server. Full unicode support is provided and it should in theory work with any keyboard layout.
Theoretically, it should work for all Linux distros and keyboard layout.

Installation

(the following installation instruction is based on Ubuntu)
Open a terminal and type:
1sudo add-apt-repository ppa:cdekter/ppa
2sudo apt-get update
For Gnome user:
1sudo apt-get install autokey-gtk
For KDE users:
1sudo apt-get install autokey-qt

Usage

Go to Applications -> Accessories -> Autokey.
autokey-main-interface
You will see on the left pane two folders named My Phrases and Sample Scripts. The My Phrases folder is binded to the hotkey “Ctrl + F7“.
To get a feel of the capability of Autokey, open a text editor and press Ctrl + F7, you should see the context menu with Address option. When you select the Home address field, you should see the address pasted to the text editor.
autokey-test-example

Usage: creating your own hotkey

To create your own hotkey, go to File -> Create -> New Top Level Folder.
autokey-new-toplevel-folder
The Top Level Folder is the container for all your phrases and scripts. You can assign a hotkey to it and call it up in any applications. To assign a hotkey, simply highlight the TopLevel Folder entry and click the Set button beside the Hotkey option. You can then choose the modifier key (Ctrl, Shift, Alt or Super) and the shortcut key.
autokey-set-hotkey
After creating the top level folder, the next thing is to create a phrase or a script.
Phrase
The Phrase is a snippet of text that you use frequently. With a quick press of the shortcut key, you can quickly insert the phrase to the document that you are working at.
Go to File -> Create -> New Phrase. Enter the phrase content in the big text area and assign a shortcut key in the Hotkey option below.
Other than assigning hotkey, you can also use a abbreviation for the phrase. For example, I have set the abbreviation “mte” to the phrase “http://maketecheasier.com”. Now I just need to type “MTE” and it will automatically be replaced with the full URL.
autokey-new-phrase
Scripts
For those who have knowledge of scripting, you can add your script, assign a hotkey and get it to run anywhere else. For those who know nuts about scripting, the “Record Marco” function can help you to record simple keyboard events.
autokey-new-script

Conclusion

For those who spend a lot of time on their keyboard, Autokey is a great tool to help you increase your productivity. Source: http://maketecheasier.com