"Natural Scrolling" in Linux (X11)

Chrome OS uses "Natural Scrolling", just like the Macs I've been using, so when I switch into xfce and it wants to scroll the old way, I get confused. Thanks to a helpful blog post on enabling natural scrolling in Linux, I didn't even have to think about how to do it. All you need is a line like the following in your xmodmap config:

pointer = 1 2 3 5 4 7 6 8 9 10 11 12

If you want a (slightly) more detailed explanation, just click on the link above. This one wasn't hard to find, but for completeness, I figured I'd document it here.

Native Client (NaCl) and 64 bit Ubuntu

I just started investigating Native Client development, using my Linux chroot on the Chromebook Pixel, and when attempting to build the examples, I got the following error:

/home/bemjb/Code/SDKs/nacl_sdk/pepper_26/toolchain/linux_x86_newlib/bin/i686-nacl-gcc: line 14: /home/bemjb/Code/SDKs/nacl_sdk/pepper_26/too lchain/linux_x86_newlib/bin/x86_64-nacl-gcc: No such file or directory

If you see something similar, it's because you don't have ia32-libs package installed. It took a lot of searching to find this forum post from someone else with Native Client issues on 64-bit Linux that confirmed that installing ia32-libs solves the issue. So hopefully having this posted here will help others in the future that run into the same issue. If anyone knows someone at Google who could update the official site, that would be even better. (I did use the "File a bug" feature in the footer of the documentation page to give feedback.)

Linux and the Chromebook Pixel

I was lucky enough to attend Google I/O this year, and the giveaway to attendees was a Chromebook Pixel. While the screen on it is amazing and I do like ChromeOS, it's a bit limited when it comes to the ability to do any development without an internet connection. Since I'd like to do that, I started looking around at ways to be able to do this. Unfortunately for me, the core of most of my development is Git, and while there is a project to create a JavaScript Git implementation, it isn't ready yet. So for the meantime, I figured that I needed to get a real command line up and running and install Git locally.

Developer mode

I was overjoyed when I found Poking around your Chrome OS device, a page on the Chromium Wiki that explains how to put your device into developer mode.

Developer mode security

I want to call this out because it is not obvious: Once you turn on developer mode, anyone can log into your Chromebook as root by switching to virtual terminal 2 (control-alt-forward, where forward is the key with a right pointing arrow to the right of esc) since by default there is no root password. If you don't ever switch to that terminal, you might not know about this, but if you're going to use your Chromebook for more than just a testing device, you should set a password by running chromeos-setdevpasswd from a terminal, which will allow you to set a password and then disbale root logins (you can use sudo to run commands as root).

Going beyond developer mode

While developer mode gives you access to a real Linux shell, there is precious little in the way of userland applications installed in stock Chrome OS. At that point, it seemed like my only options were to either build a bunch of applications myself to get a usable system or to replace ChromeOS with Linux on the Pixel. Since I actually do like Chrome OS, I decided to go the first route, even though it would be slow going and pretty hard to do.

Crouton

When I asked at the Chrome Questions area to see if there was at least a version of GCC I could download so I could build the tools I needed, I was told about Crouton (Chromium OS Ubuntu Chroot Environment). It makes it fantastically easy to get a working install of Linux alongside the standard Chrome OS install. I downloaded it, followed the instructions in the readme to install an xfce environment, and watched it fail. It turns out that for some reason, it had neglected to install the 'core' set of packages, so things weren't working right. After deleting that chroot, I then ran it with 'core,xfce', and I had success. (I've filed an issue on Crouton for xfce not properly installing core.)

UPDATE: Sounds like something else broke on my first install, it apparently didn't even get to the point of installing core. So you should be able to follow the instructions on the site no problem and just install xfce or whatever environment you like best. If you do happen to see the problem I saw, please update the bug.

Scaling X11

After everything was successfully installed, I started xfce, and realized that everything was pretty, but really, really, really small. Given that the Pixel has what is termed a "retina" screen, I searched for "linux retina", and stumbled across a blog post on properly confi guring a Retina Mac Book Pro in Linux, which had the magic incantation. The secret is xrandr, which has an option to allow you to scale your screen. The only difference from his instructions for me is that the device name on my Pixel is eDP1 instead of DP-2. I have not attemped to use the script linked to in the post, but it looks like it should work if you change DP-2 to eDP1. (Of course, you should check with xrandr -q to make sure your display device has the same name as mine.)

The Search Key

I map the Search key on the Chromebook keyboard to be another Control key, so it threw me off in xfce that the mapping wasn't there anymore. Perhaps surprisingly, the Search key isn't mapped to Caps Lock, it's mapped to Super_L. Also, the keyboard preferences in xfce don't let you remap keys (perhaps an argument to add the extra 500MB+ for Unity or KDE), so I had to fall back to xmodmap. My mappings file looks like this:

remove mod4 = Super_L
add Control = Super_L

Of course, if you replace Control with Caps_Lock, you'll have a Caps Lock key, if that's more to your liking.

The end for now

Right now, I haven't done anything to make either the scaling or the search key remapping happen automatically. If I start going in and out of xfce more often, I'll do that (and post about it), but it also shouldn't be hard to find out how to do it, as it would just be whatever standard way xfce wants one to do these things.

Anyways, I'm currently fascinated with the Pixel, as the screen is amazing and it makes me not want to use anything else. It's even more attractive because it's light and portable and now has a full development environment. (I did all of the code labs at Google I/O using it!) So hopefully, I'll have more to say about Chromebook Pixel and Chrome OS hacking in the future.