Using Colemak on the FirefoxOS Flame

As I mentioned in my previous post, I have been using a FirefoxOSAs I mentioned in my previous post, I have been using a FirefoxOSFlame developer reference phone as my daily driver. It has nowbeen about two months, and I couldn’t be happier with the phone(you can read my initial review of the Flame here [0]    I use the Colemak layout for all of my keyboards, so I wasdisappointed when the FirefoxOS 2.2 builds had the Dvorak layoutbut not Colemak. As any good developer would do, I promptly clonedthe gaia repo[1]and got ready to muck around in the system’s keyboard app. Much tomy initial dismay of being able to contribute something sweet tothe community, I found that the Colemak layout was already there,it just wasn’t enabled in the default list of layouts tobuild. This means that instead of hacking together some JS, allthat is required to get the Colemak layout on your device isediting one line in a Makefile, building gaia, and flashing ontoyour device.
** You should backup your device before mucking around in gaia **
I am not going to write about hacking on Gaia itself, thatinformation can be readily had from Gaia’s MDN page[2].
Adding Colemak to the Keyboard LayoutsIn order to get the Colemak layout on your FirefoxOS device youmust first get the gaia source. It can be cloned from Github bydoing:
git clone     cd gaia        You can look in the /apps/keyboard directory to see the source ofthe system’s keyboard app, but we aren’t going to touch anythingin there. We are going to modify gaia’s toplevel Makefile.Open ‘Makefile’ in you editor of choice. Search for’GAIA_KEYBOARD_LAYOUTS’. In my gaia repo it in line 440. Thisenvironment variable is used to determine which keyboard layoutswill be built into the system’s keyboard app – exactly what wewant to modify.Feel free to modify this line as you see fit, but in order to getthe Colemak layout you must at least add ‘en-Colemak’ to the commaseparated list of layouts. Make sure to save the file after youedit it.
Now comes the slightly scary part, we are going to build a newversion of gaia and flash it onto our FirefoxOS device. Followingthese instructions[3] we can see what we need to do. On that page theis a note about only flashing a single app instead of all of thegaia apps; There is another MDN page[4] however that cautions thatusing the APP environment variable with ‘reset-gaia’ will put yourdevice in an unstable state (my experimentation also confirmsthis). So, we are going to have to build gaia in its entirety,which doesn’t take more that a few minutes.    First make sure that you have ADB installed on your machine. Thereare installation instructions on MDN[5], and that you have enabledUSB debugging on your device from within the Developer menu.    Next connect your device to your machine. If you are using a Flamedevice, you want to issue the following command:
make reset-gaia GAIA_DEV_PIXELS_PER_PX=1.5

The GAIA_DEV_PIXELS_PER_PX environment variable specifies that youwant to use higher resolution assets. This is mentioned in a notein MDN [6] but after the ‘make reset-gaia’ command so it is easy to miss itthe first time you build gaia.
Assuming there are no build failures, your device will reboot andafter you go through the initial setup screens, you will be ableenable the Colemak layout in the Keyboards Settingspanel.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.