Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,732,170 Members 43,438 Now Online
XDA Developers Android and Mobile Development Forum

[Howto] Change the dock keyboard layout

Tip us?
 
fizban007
Old
(Last edited by Mikey; 21st July 2011 at 02:27 AM.)
#1  
Junior Member - OP
Thanks Meter 25
Posts: 8
Join Date: Jan 2009
Post [Howto] Change the dock keyboard layout

As a Colemak user I was initially frustrated with the Transformer keyboard dock, as it comes with QWERTY and there is no obvious way to change the layout. After some googling and trial-and-error I was able to solve the problem. As it seems that there is no good guide on the transformer forum on how to change the keyboard layout, I figured that I might as well write my own, so that newcomers can accomplish the same thing more easily.

Disclaimer: The following are mostly the result of my own trial&error, so it might not be totally correct. Follow the guide at your own risk! Also this requires root access so be careful and back up anything that you might change.

The keyboard layout files for the ASUS transformer lie in these folders
Code:
/system/usr/keylayout
/system/usr/xt9/keylayout
The second folder is used when you are using one of the ASUS input methods (as suggested by ASUS to "keep consistency with the physical keyboard"), whereas the first folder contains keyboard layout for general situations. The file /system/usr/keylayout/asusec.kl is the main layout profile for the keyboard dock and it is in plain text format. Its original content looks like this
Code:
key 41    GRAVE                   WAKE UNLOCK
key 2     1                       WAKE UNLOCK
key 3     2                       WAKE UNLOCK
key 4     3                       WAKE UNLOCK
key 5     4                       WAKE UNLOCK
key 6     5                       WAKE UNLOCK
key 7     6                       WAKE UNLOCK
key 8     7                       WAKE UNLOCK
key 9     8                       WAKE UNLOCK
key 10    9                       WAKE UNLOCK
key 11    0                       WAKE UNLOCK
key 12    MINUS                   WAKE UNLOCK
key 13    EQUALS                  WAKE UNLOCK
key 14    DEL                     WAKE UNLOCK
key 15    TAB                     WAKE UNLOCK
key 16    Q                       WAKE UNLOCK
key 17    W                       WAKE UNLOCK
key 18    E                       WAKE UNLOCK
key 19    R                       WAKE UNLOCK
key 20    T                       WAKE UNLOCK
key 21    Y                       WAKE UNLOCK
key 22    U                       WAKE UNLOCK
key 23    I                       WAKE UNLOCK
key 24    O                       WAKE UNLOCK
key 25    P                       WAKE UNLOCK
key 26    LEFT_BRACKET            WAKE UNLOCK
key 27    RIGHT_BRACKET           WAKE UNLOCK
key 43    BACKSLASH               WAKE UNLOCK
key 58    CAPS_LOCK               WAKE UNLOCK
key 30    A                       WAKE UNLOCK
key 31    S                       WAKE UNLOCK
key 32    D                       WAKE UNLOCK
key 33    F                       WAKE UNLOCK
key 34    G                       WAKE UNLOCK
key 35    H                       WAKE UNLOCK
key 36    J                       WAKE UNLOCK
key 37    K                       WAKE UNLOCK
key 38    L                       WAKE UNLOCK
key 39    SEMICOLON               WAKE UNLOCK
key 40    APOSTROPHE              WAKE UNLOCK
key 28    ENTER                   WAKE UNLOCK
key 42    SHIFT_LEFT              WAKE UNLOCK
key 44    Z                       WAKE UNLOCK
key 45    X                       WAKE UNLOCK
key 46    C                       WAKE UNLOCK
key 47    V                       WAKE UNLOCK
key 48    B                       WAKE UNLOCK
key 49    N                       WAKE UNLOCK
key 50    M                       WAKE UNLOCK
key 51    COMMA                   WAKE UNLOCK
key 52    PERIOD                  WAKE UNLOCK
key 53    SLASH                   WAKE UNLOCK
key 54    SHIFT_RIGHT             WAKE UNLOCK
key 29    CTRL_LEFT               WAKE UNLOCK
key 217   SEARCH                  WAKE UNLOCK
key 57    SPACE                   WAKE UNLOCK
key 100   ALT_RIGHT               WAKE UNLOCK
key 97    CTRL_RIGHT              WAKE UNLOCK
key 115   VOLUME_UP               WAKE UNLOCK
key 142   SLEEP                   WAKE UNLOCK
key 105   DPAD_LEFT               WAKE UNLOCK
key 103   DPAD_UP                 WAKE UNLOCK
key 108   DPAD_DOWN               WAKE UNLOCK
key 106   DPAD_RIGHT              WAKE UNLOCK
key 158   BACK                    WAKE UNLOCK
key 238   WIRELESS                WAKE UNLOCK
key 237   BLUETOOTH               WAKE UNLOCK
key 60    TOUCHPAD                WAKE UNLOCK
key 224   BRIGHTNESS_DOWN         WAKE UNLOCK
key 225   BRIGHTNESS_UP           WAKE UNLOCK
key 61    BRIGHTNESS_AUTO         WAKE UNLOCK
key 212   CAPTURE                 WAKE UNLOCK
key 150   EXPLORER                WAKE UNLOCK
key 62    SETTINGS                WAKE UNLOCK
key 165   MEDIA_PREVIOUS          WAKE UNLOCK
key 164   MEDIA_PLAY_PAUSE        WAKE UNLOCK
key 163   MEDIA_NEXT              WAKE UNLOCK
key 114   VOLUME_DOWN             WAKE UNLOCK
key 113   VOLUME_MUTE             WAKE UNLOCK
key 172   HOME                    WAKE UNLOCK
key 139   MENU                    WAKE UNLOCK
key 104   PAGE_UP                 WAKE UNLOCK
key 109   PAGE_DOWN               WAKE UNLOCK
key 107   MOVE_END                WAKE UNLOCK
key 102   MOVE_HOME               WAKE UNLOCK
key 86    EUROPE_2                WAKE UNLOCK
As it is just plain text, you can just open it with root explorer, navigate to the file, long press it and select "Open in text editor". Here is when root previlege comes in. You have to mount the filesystem as R/W (the button on the upper left corner in Root-Explorer) before modifying the content of this file, and this requires root.

Now it is straight forward. Just modify the file to reassign the keys. For example, change E to F in order to reassign the physical key "E" to mean "F" to the system. The complete keyboard layout for Colemak is as follows:
Code:
key 41    GRAVE                   WAKE UNLOCK
key 2     1                       WAKE UNLOCK
key 3     2                       WAKE UNLOCK
key 4     3                       WAKE UNLOCK
key 5     4                       WAKE UNLOCK
key 6     5                       WAKE UNLOCK
key 7     6                       WAKE UNLOCK
key 8     7                       WAKE UNLOCK
key 9     8                       WAKE UNLOCK
key 10    9                       WAKE UNLOCK
key 11    0                       WAKE UNLOCK
key 12    MINUS                   WAKE UNLOCK
key 13    EQUALS                  WAKE UNLOCK
key 14    DEL                     WAKE UNLOCK
key 15    TAB                     WAKE UNLOCK
key 16    Q                       WAKE UNLOCK
key 17    W                       WAKE UNLOCK
key 18    F                       WAKE UNLOCK
key 19    P                       WAKE UNLOCK
key 20    G                       WAKE UNLOCK
key 21    J                       WAKE UNLOCK
key 22    L                       WAKE UNLOCK
key 23    U                       WAKE UNLOCK
key 24    Y                       WAKE UNLOCK
key 25    SEMICOLON               WAKE UNLOCK
key 26    LEFT_BRACKET            WAKE UNLOCK
key 27    RIGHT_BRACKET           WAKE UNLOCK
key 43    BACKSLASH               WAKE UNLOCK
key 58    CAPS_LOCK               WAKE UNLOCK
key 30    A                       WAKE UNLOCK
key 31    R                       WAKE UNLOCK
key 32    S                       WAKE UNLOCK
key 33    T                       WAKE UNLOCK
key 34    D                       WAKE UNLOCK
key 35    H                       WAKE UNLOCK
key 36    N                       WAKE UNLOCK
key 37    E                       WAKE UNLOCK
key 38    I                       WAKE UNLOCK
key 39    O                      WAKE UNLOCK
key 40    APOSTROPHE              WAKE UNLOCK
key 28    ENTER                   WAKE UNLOCK
key 42    SHIFT_LEFT              WAKE UNLOCK
key 44    Z                       WAKE UNLOCK
key 45    X                       WAKE UNLOCK
key 46    C                       WAKE UNLOCK
key 47    V                       WAKE UNLOCK
key 48    B                       WAKE UNLOCK
key 49    K                       WAKE UNLOCK
key 50    M                       WAKE UNLOCK
key 51    COMMA                   WAKE UNLOCK
key 52    PERIOD                  WAKE UNLOCK
key 53    SLASH                   WAKE UNLOCK
key 54    SHIFT_RIGHT             WAKE UNLOCK
key 29    CTRL_LEFT               WAKE UNLOCK
key 217   SEARCH                  WAKE UNLOCK
key 57    SPACE                   WAKE UNLOCK
key 100   ALT_RIGHT               WAKE UNLOCK
key 97    CTRL_RIGHT              WAKE UNLOCK
key 115   VOLUME_UP               WAKE UNLOCK
key 142   SLEEP                   WAKE UNLOCK
key 105   DPAD_LEFT               WAKE UNLOCK
key 103   DPAD_UP                 WAKE UNLOCK
key 108   DPAD_DOWN               WAKE UNLOCK
key 106   DPAD_RIGHT              WAKE UNLOCK
key 158   BACK                    WAKE UNLOCK
key 238   WIRELESS                WAKE UNLOCK
key 237   BLUETOOTH               WAKE UNLOCK
key 60    TOUCHPAD                WAKE UNLOCK
key 224   BRIGHTNESS_DOWN         WAKE UNLOCK
key 225   BRIGHTNESS_UP           WAKE UNLOCK
key 61    BRIGHTNESS_AUTO         WAKE UNLOCK
key 212   CAPTURE                 WAKE UNLOCK
key 150   EXPLORER                WAKE UNLOCK
key 62    SETTINGS                WAKE UNLOCK
key 165   MEDIA_PREVIOUS          WAKE UNLOCK
key 164   MEDIA_PLAY_PAUSE        WAKE UNLOCK
key 163   MEDIA_NEXT              WAKE UNLOCK
key 114   VOLUME_DOWN             WAKE UNLOCK
key 113   VOLUME_MUTE             WAKE UNLOCK
key 172   HOME                    WAKE UNLOCK
key 139   MENU                    WAKE UNLOCK
key 104   PAGE_UP                 WAKE UNLOCK
key 109   PAGE_DOWN               WAKE UNLOCK
key 107   MOVE_END                WAKE UNLOCK
key 102   MOVE_HOME               WAKE UNLOCK
key 86    EUROPE_2                WAKE UNLOCK
However I wasn't able to remap the Capslock button. It seems that it is hardware-mapped along with the LED. When you have done the modification, save the file and restart the tablet. Now you can enjoy the new keyboard layout, WHEN NOT USING THE ASUS INPUT METHODS.

So, in order to make the Asus input methods play nicely with you new layout, you also have to modify the .kl files in the /system/usr/xt9/keylayout directory. To most users the file of interest is qwerty-en_US.kl, but if you are like me and need to type in another language, remember to change the layout file of you language as well, e.g. qwerty-zh_TW.kl for Taiwanese people. The method is again the same as above. Note that this only reassigns keys on your physical keyboard, not those on the on-screen software keyboard.

About some terminal emulators

I use Better terminal emulator as my daily virtual terminal, and it has an annoying bug. If I start the app when using some input method other than the ASUS English keyboard, it doesn't change back for me, and sometimes there is no keyboard icon in the notification and even the key combination Ctrl+Shift doesn't work. If I just use Ctrl+Space then it will switch to an unknown input method and my modified keyboard layout is not detected. To fix this, simply switch to ASUS English keyboard before opening the terminal emulator (say, opening the google search and choose the input method).

About ESC and BACK

Now if you also use this tablet to SSH into your server to do some maintanence stuff, you will notice that there is one thing missing on the keyboard dock, which is the ESC key. In the place of the ESC, there is the BACK key which will take you out from the terminal you are using, which is quite frustrating especially if you use vi or vim on your server. To fix that, simply change the BACK key to ESCAPE in the asusec.kl file. Now if you still miss a back key which could come in handy when just using the tablet, I would suggest mapping the WIRELESS key to the right to BACK, as I can't really think of a situation where you really need to quickly toggle the Wifi on and off. Most (or all, since I didn't experiment with all the keys) of the shortcut keys can be thus shuffled around.

Remapping Function keys to F1~F12 (Partial Solution)

Sometimes it is desirable to have the usual function keys like F1~F12 handy. The above method can be applied to change the first row to these function keys. Say we can just change BLUETOOTH to F1 in the file asusec.kl. However at most times it is more useful to retain the original behavior of those keys, which is one of the reasons that the keyboard dock is so handy. I found a partial solution to the problem.

After changing, say BLUETOOTH to F1, in order to preserve the BLUETOOTH toggle functionality, we can modify the following file
Code:
/system/usr/keychars/asusec.kcm
Again it is a plain text file. The idea is to let the original BLUETOOTH key to act as F1, but Shift+F1 will let us toggle BLUETOOTH as we want. In order to accomplish this, add to the end of the file
Code:
key F1 {
    shift:                    fallback BLUETOOTH
}
Ideally this will allow us to access the toggle functionality whenever we press Shift+F1. However this is labelled as a partial solution because this combo only works in an input field, like that of Google search. I'm still investigating how to make it work in general situations and will update any findings here.

OK, that's it. This is my first serious post after a year of silent surfing on the forum. Hopefully this will be useful to some people. If I posted on the wrong section or did anything inappropriate, please tell me immediately as I'm still relatively new to this forum.
The Following 24 Users Say Thank You to fizban007 For This Useful Post: [ Click to Expand ]
 
SplasPood
Old
#2  
Junior Member
Thanks Meter 0
Posts: 27
Join Date: Nov 2008
Default Thanks!

For your first post it was a great one. Specifically remapping the Back key to escape is something I've wanted to do since the moment the dock arrived. Thanks again.
 
gwai_jai
Old
#3  
Junior Member
Thanks Meter 0
Posts: 11
Join Date: May 2009
is there any way to map the F1-F12 keys onto the keyboard effectively replacing the Function keys(wireless, bluetooth, etc) as i really need it for work
 
axe2
Old
#4  
Senior Member
Thanks Meter 6
Posts: 103
Join Date: Dec 2009
Location: Tucson, AZ
What problem did you encounter remapping the caps-lock key? I remap caps-lock to left-control, and it works great. I also remap back to escape and left-control to back. I don't use caps-lock, so I do not have that mapped to any key at the moment.

I've been doing this for a while, and the most anoying thing is that it gets reset when a new ROM is installed. Keep a backup somewhere of the modified file so you don't have to re-edit it again...

Sent from my Transformer TF101 using Tapatalk
 
rilot
Old
#5  
Senior Member
Thanks Meter 13
Posts: 314
Join Date: Sep 2005
Thanks for this post. Very useful.

Is there a way to get a DELETE key rather than a BACKSPACE key? This would be most useful.
Surface RT, Note 2
iPad3, iPhone 4S
 
isolated_epidemic
Old
#6  
Senior Member
Thanks Meter 23
Posts: 215
Join Date: Sep 2007
Location: Spokane, WA
How about remapping the trackpad right click? Is that possible?
 
fizban007
Old
#7  
Junior Member - OP
Thanks Meter 25
Posts: 8
Join Date: Jan 2009
Quote:
Originally Posted by gwai_jai View Post
is there any way to map the F1-F12 keys onto the keyboard effectively replacing the Function keys(wireless, bluetooth, etc) as i really need it for work
Remapping the function keys(wireless, etc.) is not a problem. You can just use the aforementioned method and change, say, BLUETOOTH to F1. However it is more desirable to retain the functionality of those keys as in the android environment. I've currently experimenting, and found a partial solution, which I included in the original post. Hope it helps you.
 
fizban007
Old
#8  
Junior Member - OP
Thanks Meter 25
Posts: 8
Join Date: Jan 2009
Quote:
Originally Posted by rilot View Post
Thanks for this post. Very useful.

Is there a way to get a DELETE key rather than a BACKSPACE key? This would be most useful.
I believe in most situations Shift+Backspace will act as Delete.
The Following User Says Thank You to fizban007 For This Useful Post: [ Click to Expand ]
 
rilot
Old
#9  
Senior Member
Thanks Meter 13
Posts: 314
Join Date: Sep 2005
It does in some things but doesn't in my terminal emulator. The soft keyboard Thumb Keyboard works fine though. Hmm.
Surface RT, Note 2
iPad3, iPhone 4S
 
fizban007
Old
#10  
Junior Member - OP
Thanks Meter 25
Posts: 8
Join Date: Jan 2009
Quote:
Originally Posted by rilot View Post
It does in some things but doesn't in my terminal emulator. The soft keyboard Thumb Keyboard works fine though. Hmm.
Oh if you are using Bash in your terminal emulator then Ctrl+D will act as delete forward. No need for a dedicated delete key. Which terminal emulator are you using?

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes