Saturday 14 March 2015

Remapping keys in Linux Using Autokey

A few days back, the G and H keys on my laptop's keyboard stopped working. On windows I was using a program called AutoHotKey to remap those keys to other less often used keys like [ and ]. After installing a linux distribution called Lubuntu though, I found no way of doing it until I found a program called Autokey. There are other ways to remap keys in linux which we will look at in another post. In this post, I will show you how you can do it using Autokey.

You can't remap modifier keys, function keys and other keys like Tab, PageUp, Esc etc using Autokey(It can be done using another tool called xmodmap. Here is a turorial on how to do it). Any other key on a keyboard can be remapped. I am using Lubuntu but it will work on any linux distribution.
Video tutorial can be found at the bottom of the page.

1. The first thing to do is to install Autokey on your linux distribution.


2. Open Autokey.


3. Create a sub folder under 'My Phrases' and name it something like 'Key_Remap' and press OK.


4. Now you should see the sub folder which you created under 'My Phrases' folder like this:


5. With Key_Remap selected, create a new phrase and name it 'key_g'. I am calling it key_g because I am going to remap lower case G with this phrase. We will have to create another phrase for upper case G later.

6. Select 'key_g' and you should see a text area on the right containing 'Enter phrase contents'. Delete that and type ' g ' without the quotes there.

7.  Now click on the 'Set' button just opposite 'Hotkey:'


8. A window will open up now. This is where you need to set the key to which g should be mapped to. I am going to map ' g ' to ' [ '. In the window, note that 'key:' shows '(none)'. Now click on 'Press to set' button and press the ' [ ' key on your keyboard. Now 'key:' should show ' [ '. Click OK.


9. Save the changes.


10. Now for the upper case G, create a new phrase and call it 'key_G'. Type 'G' in the text area, click on set key opposite Hotkey:.

11. This time, we need to map G to ' { ' (Shift modified version of' [ ') so that pressing Shift + [ will actually give us the upper case G. So  this time, click on 'Press to set' and press the ' [ ' key just like the last time but after that, click on the 'Shift' button on the window(not on the keyboard) and press OK.

12. Save the changes and you are done.

13. Now pressing ' [ ' on the keyboard will have the effect of pressing ' g ' and pressing 'Shift' + ' [ ' will have the effect of pressing ' G '.

For this to work, you need to have Autokey running. You can close Autokey and it will be minimized to the system tray. To quit the program, you have to right click on Autokey's symbol in the tray and select quit.
Video Tutorial: 

No comments:

Post a Comment