Daily Archives:October 15th, 2011

Taking control of your Mac keyboard

I’m very fond of my little Apple Bluetooth keyboard. Apart from the slightly ridiculous notion of having batteries in a peripheral device which never moves around, it does just what I need: full-size keys, with the cursor keys in a proper configuration, but no numeric keypad to make me stretch my wrist out to unusual angles when reaching for the mouse or trackpad.

However, there is one thing that bugs me. The Ctrl key is not in the bottom left corner where God intended Control keys to be! (Unless you worship the Sun god, in which case you may like your Control keys in the place more commonly used for Caps Lock.) But Sun worshippers, and others who do not consider the Caps Lock key to be evidence of intelligent design, can do something about it: in System Preferences you can remap your Caps Lock to do something useful, like control.

But I don’t think anybody, reaching for the Ctrl key, finds their fingers moving naturally towards the second key from the bottom-left.

Many MacBook Pros have the same layout.

For many Mac users this won’t be an issue, because the Cmd and Option/Alt keys are more important, but if you spend most of your time at the command line or in certain editors, you’ll be hitting the Fn key all the time, and inserting spurious characters into your text.

But today, I found one utility (and only one) that will let me remap the Fn key so it operates as Ctrl: the snappily-named KeyRemap4MacBook.

This offers a scary range of options to remap all sorts of things, but hidden in there is the one I needed:

Perfect. This makes the Fn key operate like the right-control key, which means I can do all those Emacs-y things like Ctrl-A to go to the beginning of the line, but interestingly it doesn’t change its effect on the function keys, so I can still use them to do Volume Up & Down etc.

Update: A little later I found that, while the volume keys worked without any further adjustment, some of the other top-row ones didn’t – in particular, the brightness controls. And, in fact, KeyRemap4MacBook comes with a better solution to my problem: there’s a single configuration under the ‘Change Fn Key’ settings that maps the Fn key to be Ctrl, and Alt-Fn to be Fn. Even better.

That was all I wanted, but I dug a little bit further and discovered that, if you’re willing to edit some XML configuration files, you can create your own arbitrary mappings.

As a programmer, I use # much more than I use £, but on the UK Apple keyboard, you have to press Alt-3 to get the #. So I wanted at least to swap with Shift-3, which is £.

Here’s the XML to do it:

<?xml version="1.0"?>
<root>
    <list>
        <item>
            <name>Swap £ and # on UK keyboard</name>
            <identifier>private.swap_pound_and_hash</identifier>
            <autogen>--KeyToKey-- KeyCode::KEY_3, ModifierFlag::SHIFT_L, 
                                        KeyCode::KEY_3, ModifierFlag::OPTION_L</autogen>
            <autogen>--KeyToKey-- KeyCode::KEY_3, ModifierFlag::OPTION_L, 
                                        KeyCode::KEY_3, ModifierFlag::SHIFT_L</autogen>
        </item>
    </list>
</root>

I may eventually put # on another key like, say, ‘§’. Who uses ‘§’ outside the publishing world, anyway?

Or – aha – perhaps that’s the best thing to do with CapsLock…

Update: If you use this keyboard with Linux, you might want to check out Phil Endecott’s page here.

By hook or by crook…

Here’s a way to make yourself feel really stupid: take the SD card out of your camera and slam it happily into the slot in the side of your iMac, only to have it disappear completely. After a short, stunned moment, the realisation slowly sinks in that you have pushed it into the CD/DVD slot instead. How, you wonder, could anyone do something so foolish?

Well, here’s what the side of my 27″ iMac looks like, in a good light, after I have moved my head about 2 ft to the right from my normal sitting position:

I hope you’ll agree that it’s not quite such a daft thing to do. I certainly hope that, and so do the correspondents on this thread on the Apple support forum, where you can read several pages of confessions from people as foolish as me, and some helpful suggestions as to how to get it out again.

Based on one of those hints (Thanks, Cathy1956!) I fished it out with this elegantly-crafted tool:

Getting SD card out of CD/DVD drive

It’s good for people like me to have support groups in times of great need.

© Copyright Quentin Stafford-Fraser