Making your Mac keyboard function better (as it were…)

Here are a couple of menu-bar apps I run on all my Macs:

Keyboard Maestro

Keyboard Maestro is a quirky and exceedingly useful utility. It’s a bit like Automator, but with a whole range of different capabilities. At its simplest, it responds to an event (like a particular key combination) and executes a set of actions (like, say, opening an app and moving its window to the top-right quarter of the screen).

But it can do more complex operations. Sometimes, for example, I have apps that respond to particular hot-keys, but only if they’re running; I can use Keyboard Maestro to detect the keystroke, and if the app isn’t currently open, it’ll fire it up and then send the keystroke on to it, or choose the equivalent option from its menus. More about keyboard shortcuts later.

A set of actions can be triggered by more than just keystrokes, too. You can have them run when:

  • The system wakes from sleep
  • The contents of the clipboard change
  • A button is pressed on an attached MIDI controller
  • A particular USB device is plugged in or turned on
  • You connect to a particular wifi network
  • Every 15 minutes
  • An item is added to a particular folder
  • A particular application starts
    to name a few…

Its one of those utilities that will be used in a different way by almost everyone who installs it. Here are some of my most-used triggers:

  • When I press Fn-J, it opens my journal (nvAlt)
  • When I plug my GPS logger into the USB socket, it moves all the track files onto Dropbox and runs various scripts on them, then ejects the USB drive so I can just unplug it.
  • When I turn on (or open the lid of) my scanner, it fires up various things to help with my paperless workflow. When I turn it off, it closes all the windows it opened.
  • When I wake up my laptop, it waits a few seconds to let things stabilise, then checks whether I’m on my home wifi network, and if so, it mounts my photo and music shares from my Synology server.
    None of these is vital, but all of them make my life easier, and creating them with keyboard Maestro is really pretty easy. Recommended.

Karabiner

Karabiner used to go under the snappy name of KeyRemap4MacBook, which was horrible, but at least somewhat descriptive! This little utility is even more quirky than Keyboard Maestro, and has a rather poor user interface, but it’s one of those things that, once you’ve set it up, does its job reliably and predictably, so you seldom need to touch it again.

It lets you remap your keyboard in various ways, and, despite its previous name, works on much more than just MacBooks. You can do very powerful things with this, especially if you want to go as far as customising bits of XML configuration, but normally you’ll just want to pick from a few of the standard options.

It’s really useful if you switch between different keyboards and want, say, to make the PC-style keyboard in the office work more like the Mac keyboard at home, or the other way around. I have Apple keyboards everywhere, so this is less of an issue, but I use it for just two things:

A ‘hyper’ key

I have a few global keyboard shortcuts that I use all the time, like the one mentioned above to open my journal, and another to create an item in my to-do list. I don’t want these to be buried under two many modifier keys (shift-ctrl-T), but I also don’t want them to clash with keyboard shortcuts used by my apps: I want them to work the same everywhere.

The secret is to create a new modifier key, sometimes called ‘Hyper’, which nothing else uses! I forget who came up with this idea originally, but the trick is to map, say, your Function (fn) key to produce Shift-Ctrl-Alt-Command, which no app ever uses for its shortcuts because it’s too much of a pain to type. Karabiner has a setting to do precisely this, without affecting The normal use of Fn when pressed with, say, the function keys. The, by setting my hotkeys in things like Keyboard Maestro to things like Fn-J (which it interprets as Shift-Ctrl-Alt-Cmd-J), I can just type Fn-T to create To-do items, Fn-J to create journal entries, Fn-D for my diary, and so forth, and I know that they work anywhere on my system.

A coder’s UK keyboard

I have UK keyboards, which I prefer to US ones, except that they have a £ when you type shift-3. I’m a programmer, and not a wealthy one, which means I need a ‘#’ far more often than I need a ‘£’. This does involve a short bit of XML: you just need to follow these instructions and paste in the code below, after which you’ll have an option called ‘Swap £ and # on UK keyboard’.

I hope others find those useful too!

<?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>

Enjoyed this post? Why not sign up to receive Status-Q in your inbox?

2 Comments

Why didn’t you have the “identifier” read “private.swap_pound_and_pound”? 😉

Got Something To Say:

Your email address will not be published. Required fields are marked *

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax

*

© Copyright Quentin Stafford-Fraser