Linux on my MacBook Pro

So, in the midst of finals, I decided to install the new Ubuntu 10.04 GNU/Linux OS on my MacBook Pro. A wellspring for procrastination, no doubt, but also I was again becoming concerned about my dependence on proprietary software. Combine that general orientation with some of Apple's recent policies and I was looking to escape – or, at least, to map out a possible escape route.

The Ubuntu Apple/Intel installation directions were very helpful, although things didn't go exactly as advertised. First, neither of the Mac tools (Disk Utility or Boot Camp) were able to shrink my partition. The got about halfway and then gave up and said it couldn't be done. That means I'd have to nuke and reinstall MacOS to make this work. It's a testament to my resolve – and my trust in rdiff-backup – that I did just that.

So after reinstalling Snow Leopard on a shrunken partition, installing rEFIt as the initial boot loader, the Ubuntu install went smoothly. The only other thing that went wrong was that grub (the secondary boot loader) did not configure itself properly. Fortunately, grub has a command line and it's possible to guess the right incantations to get it to boot anyway.

It has been years since I used any sort of GNU/Linux desktop. From 1996 to 2005, my office machine was always Linux – at three different offices. In 2001 I bought my first Mac laptop (an iBook) but I did not start using Mac exclusively (or nearly so) until 2005, with my beloved 12” PowerBook. Even then, my two most well-worn apps are definitely emacs and zsh.

Anyway, a lot evolves in five years, especially thanks to the hard-working and well-funded folks at Ubuntu/Canonical. It has been a learning experience, but mostly positive. I love having all software managed by apt, once again. Still think the Mac platform could benefit from this kind of an app repository — as long as unsanctioned sources are permitted. The Mac apps that may be the hardest to replace are: Keynote (OpenOffice Presentations are fine compared to Powerpoint, but Keynote is a cut above), Skim and BibDesk (PDF annotations and bibliography tracking that work well together — both open source, but reliant on Mac GUI), and ScreenFlow (really great for capturing and editing screencasts).

The first thing I felt I had to get sorted, though, was the keyboard! Mac apps specialize in the so-called ‘command’ key (⌘), with control and option as distant cousins. Linux/Gnome apps prefer the control key, with ‘alt’ as a close second. So I wanted two control keys, and in better positions than the existing one. Below is the layout I came up with. It has left and right control, left and right alt, a ‘super’ [win] key (which is great for mapping window and desktop management functionality so it doesn't conflict with emacs) and the ‘multi’ key (aka compose character) for typing accented and other “§peçìâł” characters.

I did not rearrange the alphabetic key-caps as shown in the picture (by doommeer on Flickr, used with permission – CC:by-nc-sa) but I do use the layout shown. I've been typing Dvorak every day since 1994 or so.

Below is the Xmodmap configuration that achieves this modifier-key layout on the MacBook Pro. X key configuration is a little wonky, to say the least. The key codes I explicitly unmap here (6c, cc, etc.) seemed to interfere with the ones I wanted; there can be only so many syms for each modifier. This still isn't perfect; the right control key auto-repeats unless I xset it not to, and I have to semi-manually switch to a different configuration (via a .Xmodmap symlink) when I dock the laptop with my Kinesis QD contoured keyboard.

More later on other applications and tricks, but for now I'm pretty happy. The machine dual-boots just fine with rEFIt, and although I have all my stuff (except for music – too big for a partitioned drive) synced on both sides, when that chooser screen pops up, I always go with the penguin.

clear shift
clear lock
clear control
clear mod1
clear mod2
clear mod3
clear mod4
clear mod5

keycode 0x6c =
keycode 0xcc =
keycode 0x69 =
keycode 0xce =

keycode 0x42 = Control_L
keycode 0x68 = Control_R

keycode 0x85 = Alt_L
keycode 0x86 = Alt_R

keycode 0x25 = Super_L
keycode 0x40 = Multi_key

add shift   = Shift_L Shift_R
add lock    = Caps_Lock
add control = Control_L Control_R
add mod1    = Alt_L Alt_R
add mod3    = Super_L

©20022015 Christopher League