Saturday, January 15, 2011

Workaround for a broken down key on a MacBook Pro

Recently, I had the shocking revelation that my MacBook Pro's down key stopped working. It's a lot like they say about losing your pinky finger, you don't realize how much you need it until its gone. Man, I loved that down key. With the possible exception of the space bar, I probably use the down key more than any key on my keyboard (which may be why it wimped out on me).

The "guru" at the Apple Store told me that fixing it would require an entire replacement of my keyboard, at a cost of ¥30,000. Ouch.

That's just the excuse I needed to buy a new MacBook Air, but the frugal side of me insisted that I explore other options. Like a person losing a pinky finger accomplishing pinky tasks with a ring finger, I could go on if I found a suitable substitute key.

After doing a bit of Googling, it turns out many Mac adapters miss using their "home" and "end" keys. There were quite a few sites explaining how to customize the Mac keyboard to do all sorts of crazy things, including mapping "home" and "end" keys.

This is done by creating the "~/Library/KeyBindings/DefaultKeyBinding.dict" file, which allows Cocoa-based applications (like textmate) to recognize customized key allocations. Here's a good example.

So I followed the same process for the "down" key.

First, open up "Terminal" and type the following.

And add this bit of text.

In case you're not familiar with "vi", this is done by first typing "a", then copying/pasting the code above, then hitting "escape", then typing ":wq".

This was all done, mind you, without the use of a "down" key. Tricky business.

If you're curious, the commands ("moveDown:", etc) are all listed on Apple's developer center - here's the link

Now, "ctrl+(up arrow)" mimics the use of the down key. Similarly, adding the "command" key or "shift" key on top of this also allows you to go to the end of a document, and highlight.

Mind you, this only works for Cocoa-based applications. For now, this will have to do.

No comments:

Post a Comment