Skip to main content

How to map keys using autokey for bluetooth keyboard, ubuntu.

Updated by Tim Rabbetts on
autokey keyboard mapping

I recently brought a new Bluetooth keyboard from amazon (made in China).  The keyboard is fine but some of the keys haven't been mapped correctly, turns out some of the keys are not mapped to their key correctly they are mapped to strange combos like <super>+<down>.  I had problems with the home, end, page up, page down, |¬ pipe keys.  To solve this I installed autokey, you can remap keys but it is not overly simple.

 

Install autokey using gtk or qt for the graphical user interface (the UI).  I tried the qt version on Linux Mint OS and it rendered the text strange, the cursor was never where the text was so I used the gtk version which is perfect.

 

I would create a folder first to store your scripts.  All scripts are stored in .config/autokey on Linux.

 

Create a new script file.

 

autokey main dialog

 

The hotkey section is where you specify the key being pressed, if you click "Set" you get this popup below.

 

autokey press to set dialog

 

If you press "press to set" and then hit the key on your keyboard it will tell you what event that key triggers, can be helpful to understand what is triggered as I press "end" for example and it actually trigger <super>+<right>.  Press and set the key.

Now the slightly tricky bit, the script is a python script and we need to trigger the correct end keypress.  In the example above, for the end key, which triggers <super>+<right>, I then set the script to this:

 

autokey script

 

So now my end key works, however, there is a chance that the key combination <super>+<right> has a corresponding keyboard shortcut set for the OS.  

This would kick in before autokey gets its chance.  

To change this it would be different on each OS, but for Linux Mint in keyboard settings.  There is a shortcut section, I found that the tile windows commands were mapped to the <super>+<right> etc combinations.  

 

linux mint keyboard settings

 

So even though autokey worked, it was messing with my windows first.  I just went in and set them to a different combo and hey presto it all starts to work.  I hope this saves someone a bit of time.

 

 

 

Add new comment