I just bought myself a S3 Yoga 14. After installing Ubuntu 16.04, I found out that the key that was suppose to spew out 'pipe' and 'backward slash' (when shifted) actually spewed 'greater than' and 'less than'. This little write up explained how I fixed it.
As a reference, please read this first to get some relevant information:
http://www.antoniusdharijanto.com/2015/10/simple-key-re-mapping-on-ubuntu-1404.html
Steps
1. Figure out the keycode of the offending key
There's a little program 'xev' that when runs from terminal, it would give information about whatever key is pressed, including the keycode.
2. Figure out what the key from (1) is supposed to map into.
Since I have another laptop running Ubuntu, I just run xev there and figure out the keycode of the key 'pipe' and get the action from /usr/share/X11/xkb/keycodes/evdev
2. Re-map that keycode to pip
Open up /usr/share/X11/xkb/keycodes/evdev and remap that keycode to the proper functionality.
Update:
The key to be updated was:
<BKSL> = 94; // Note that other occurence of BKSL has to be commented out for this to work
Random useful tech stuffs I write to remind myself. Hopefully useful for you!
Showing posts with label XKB. Show all posts
Showing posts with label XKB. Show all posts
Thursday, May 4, 2017
Sunday, October 4, 2015
Simple Key Re-Mapping on Ubuntu 14.04
This tutorial shows how a simple key remapping can be done using XKB, which is the standard keyboard mapper that Ubuntu 14.04 uses.
To give a little background, I have a ThinkPad X201. Around the laptop's arrow keys, there are two keys that act as BACK and FORWARD (as in the Internet-browser sense), which I found really redundant since I always use the combo of "ALT+LEFT" or "ALT+RIGHT" to achieve the same goal. And so I decided to remap these keys to "PG DOWN" and "PG UP" respectively.
As I researched around achieving this, I found that XKB is pretty complex. For example, it allows remapping a key to different keys, depending on the modifiers (e.g. A becomes B, while Alt+A would become Alt+C) While what I wanted was very simple, most of the resources I found online were pages long trying to explain the quirks of XKB. Now that I've learned how to achieve my remapping, I'm doing a brain-dump here :)
Goal: To map "BACK" and "FORWARD" to "Pg Down" and "Pg Up"
Steps:
aharijanto@aharijanto-ThinkPad-X201:/usr/share/X11/xkb/symbols$ git diff
diff --git a/symbols/inet b/symbols/inet
index 5c4784e..8e522aa 100644
--- a/symbols/inet
+++ b/symbols/inet
@@ -144,8 +144,10 @@ xkb_symbols "evdev" {
key <I163> { [ XF86Mail ] };
key <I164> { [ XF86Favorites ] };
key <I165> { [ XF86MyComputer ] };
- key <I166> { [ XF86Back ] };
- key <I167> { [ XF86Forward ] };
+// key <I166> { [ XF86Back ] };
+ key <I166> { [ Prior ] };
+// key <I167> { [ XF86Forward ] };
+ key <I167> { [ Next ] };
// key <I168> { [ ] }; // KEY_CLOSECD (opposite of eject)
key <I169> { [ XF86Eject ] };
key <I170> { [ XF86Eject, XF86Eject ] };
To give a little background, I have a ThinkPad X201. Around the laptop's arrow keys, there are two keys that act as BACK and FORWARD (as in the Internet-browser sense), which I found really redundant since I always use the combo of "ALT+LEFT" or "ALT+RIGHT" to achieve the same goal. And so I decided to remap these keys to "PG DOWN" and "PG UP" respectively.
As I researched around achieving this, I found that XKB is pretty complex. For example, it allows remapping a key to different keys, depending on the modifiers (e.g. A becomes B, while Alt+A would become Alt+C) While what I wanted was very simple, most of the resources I found online were pages long trying to explain the quirks of XKB. Now that I've learned how to achieve my remapping, I'm doing a brain-dump here :)
Goal: To map "BACK" and "FORWARD" to "Pg Down" and "Pg Up"
Steps:
- Figure out the keycodes for "BACK", "FORWARD", "Pg Down", and "Pg Up"
- The codes can be found at /usr/share/X11/xkb/keycodes/evdev
- They are: I166, I167, PGUP, and PGDN
- Figure out how the keycodes are used
- Go to /usr/share/X11/xkb/
- Grep for the keys above:
- I166 and I167 are used by /usr/share/X11/xkb/symbols/inet, by default mapped to "XF86_Back" and "XF86_Forward"
- PGUP and PGDN are used by many files. One of them is /usr/share/X11/xkb/symbols/pc, whic shows that they map to "Prior" and "Next"
- Customize the keycodes' mapping:
- In accordance to the finding in (2), change "XF86_Back" and "XF86_Forward" that are used by I166 and I167 to "Prior" and "Next"
- Erase XKB cache files
- Remove all *.xkm files under /var/lib/xkb/
- Reboot
- Enjoy!
aharijanto@aharijanto-ThinkPad-X201:/usr/share/X11/xkb/symbols$ git diff
diff --git a/symbols/inet b/symbols/inet
index 5c4784e..8e522aa 100644
--- a/symbols/inet
+++ b/symbols/inet
@@ -144,8 +144,10 @@ xkb_symbols "evdev" {
key <I163> { [ XF86Mail ] };
key <I164> { [ XF86Favorites ] };
key <I165> { [ XF86MyComputer ] };
- key <I166> { [ XF86Back ] };
- key <I167> { [ XF86Forward ] };
+// key <I166> { [ XF86Back ] };
+ key <I166> { [ Prior ] };
+// key <I167> { [ XF86Forward ] };
+ key <I167> { [ Next ] };
// key <I168> { [ ] }; // KEY_CLOSECD (opposite of eject)
key <I169> { [ XF86Eject ] };
key <I170> { [ XF86Eject, XF86Eject ] };
Subscribe to:
Posts (Atom)
