My personal computer is an old Lenovo G560, whose keyboard recently started showing signs of wear, with the double-quote/single-quote key being the first to give out. As someone who likes to write code, losing the quote key is a real inconvenience. Sure, I could spend some cash for a new keyboard, but what good is your knowledge in software if it can’t help workaround hardware problems? :P
So I decided to implement the lost key by re-mapping an existing key to behave like it. I chose the semicolon/colon key here. The idea is simple: I’d remap the semicolon/colon key to print single and double quotes with key modifiers (Right Alt and Shift)
Alt + Semicolon = Single Quote + =
..and, Shift + Alt + Semicolon = Double Quote + + = +
To achieve this, what you need to do is create a custom keyboard layout. In Ubuntu, all the keyboard layouts (for different languages and such) are located at
/usr/share/X11/xkb/symbols/. Now, you can chose to create a new file altogether, or add a variant to an existing file. I chose the latter, so I added the following lines to the US Keyboard layout located at
1 2 3 4 5 6 7 8 9
Here, I define a new keyboard layout named
kmmankad, and its description is specified under
include "us(basic)" line includes the basic US keyboard layout, since ours is really just one key away from the default US basic. Thats what the next line is about.
AC10 - A (for alphanumeric). The second letter could take values from A-E (rows 1 to 5, bottom to top - rowA is the spacebar row) and 1-12 (key position in the row, going left to right). So with that co-ordinate system, we locate semicolon as
AC10. After the key is defined, you the next four values will correspond with what the key will produce by itself, with Shift, with AltGr (usually the right Alt key), and Shift+AltGr respectively. Easy peasy.
Now that we have this defined, We need to update
/usr/share/X11/xkb/rules/evdev.xml to include this new layout.
1 2 3 4 5 6
Note that the name and description should match what you entered earlier in
Now, restart your machine and you should have your new keyboard layout available under
System Settings ->
Text Entry (see bottom right) ->
Select, Test and Done. Hope this was helpful!