Make Your Keyboard Fit You

· 3 min read
Make Your Keyboard Fit You

As far as I know, everyone that uses computers will have at least one keyboard, otherwise you will see the classical sentence when you trying to boot your computer:

Keyboard not found, press F1 to continue.

But, have you ever think about where the proper place for the F1 key is? Maybe on the right of the space key, or any other place you want? If you have never thought about this question, now is the time to do that.

As a vim user, the most frequently used key is the ESC key that exits from INSERT mode to NORMAL mode, but on a normal ANSI keyboard, the ESC key is very far from your hand, even on some big keyboards, you have to move your left hand to touch the key. But just on the left of your left little finger, there lies a, to some extent for me, useless key, the Caps Lock key, which is nearly never used. When I was young, I always cannot stop thinking, what if I could exchange the two keys, or even adjust the keyboard layout as my requirements.

On my master grade one, here comes the chance: I finally made up my mind to buy a mechanical keyboard. Before the purchase, I occasionally got to know an open-source 60% keyboard project whose layout could be modified.

The layout can be designed on Keyboard Layout Editor, the editor can generate a raw data which records the keyboard layout of your designation, and you can copy the raw data to a TMK keymap generator, like tkg.io, to generate a EEPROM (Electrically Erasable Programmable Read-Only Memory) file, the .eep file. With the .eep file, you can then use the tkg-toolkit to reflash your layout to your keyboard.

The first step of making your own keyboard layout is just to design your layout. On Keyboard Layout Editor, you can make your designation based on some presets or just create one on your own. I chose the preset Default 60% to start, as my keyboard is a standard 60% key board.

When you have finished your designation, choose the Raw data page and you will see the raw data that you will use in the next step. Besides, you can also adjust your keyboard layout, or even the keyboard itself on this page. The syntax of raw data can be found here and you can find my layout from here:
Screenshot_20180204_025723

The second step is to generate a .eep file that will be used by the toolkit to reflash your keyboard layout. On tkg.io, choose the type of the keyboard as GH60 (RevCHN), and paste your raw data in the textbox on the Simple page. Then the program will check your layout raw data for conflicts and other error (e.g. a key does not exists or is not supported), if there is no error in your layout raw data, continue with Fn key configurations and backlight configurations.

On my layout, I use the Fn0 key for F1 to F12 keys and some other function keys, the Fn1 key for the switch of backlight, and the Fn2 key and the Fn3 key for adjust backlight mode. So I configure Fn0 key with momentary layer 1, Fn1 key with backlight toggle and Fn2 key and Fn3 key with backlight decrease level and backlight increase level respectively.

For Caps Lock light, bind the backlight of Caps Lock with indicator on Caps Lock with backlight, and other lights, bind none with backlight will be OK.

After that, the second step is done. You can make a double check on your configurations and click the Download .eep file on the bottom of the page. If you make your configuration as I said above, you will see something similar to:
Screenshot_20180204_001346

The last step is to reflash the .eep file to your keyboard. First, clone the TKG toolkit repository from https://github.com/kairyu/tkg-toolkit, and install dfu-programmer with your package manager (on Arch, you can install it directly from AUR).

Then, run the setup.sh script to set your toolkit with keyboard type of GH60 RevCHN, firmware of Default and bootloader of atmel_dfu. And finally, run the reflash.sh script with the .eep file you downloaded above. When the script says "Waiting for Bootloader...", press the button on the back of your keyboard PCB for at least 7 seconds, then the script will reflash the layout to your keyboard. If nothing happens, try with sudo.

Finally, enjoy your keyboard, the keyboard that knows you.