Custom keybindings in MailMate

Published
2014-05-06
Tagged

MailMate is easily my favourite email client. If mutt is the vim of email clients, then MailMate is the Sublime Text: incredibly geeky under the hood, but with just enough of a polished veneer that I don’t have to :wq to get out of a half-written draft.

One of the problems I’ve found recently is that there’s no way to archive an entire thread. Consider the following situation1:

Oh, the lip of that Commodo Non Irure

I’ve read both these messages, done something, and want to archive the whole thread. How could I do this?

  1. I could just hit e (archive) twice, archiving both messages.
  2. I could shift-select both messages and hit e.
  3. I could hit to close the thread, then hit e to archive the whole thing.

It’s OK when it’s just two messages, but what about when the thread contains four messages? Five? Options 1 and 2 are both O(n) operations, and option 3 feels…weird. Surely in something like MailMate, there must be a way of setting a new keybinding…

Oh wait there is.

Adding an “archive thread” keybinding

The MailMate manual (linked above) very handily explains how to set up your own custom keybindings. All you need to do is make a plist file in ~/Library/Application Support/MailMate/Resources/KeyBindings and you’re all set. The plist file’s format isn’t even that complex: something I was initially worried about. Here’s a sample keybinding plist2:

1
{
2
  "c" = "newMessage:";
3
  "n" = "nextMessage";
4
5
  // Combo keys
6
    "g" = {
7
      "a" = ( "goToMailbox:", "ALL_MESSAGES" );
8
      "s" = ( "goToMailbox:", "FLAGGED" );
9
  }
10
}

Notice how simply it’s laid out, and how easily you can queue up multi-keystroke bindings and more complex system calls. Now if only there was some big reference of every selector we can call.

Oh wait I’ve used this setup before.

There’s one problem: MailMate has no archiveThread: selector. Alongside archive:, however, we see the handy note:

Shorthand for ( ‘moveToMailbox:’, ‘archive’ )

And right underneath the moveToMailbox: selector there’s a similar selector called moveThreadToMailbox:. That sounds like what we want.

So now all I need to do is make a file in Application Support, which I’ll call Jan.plist. The contents of this file are as follows:

1
{
2
  "E" = ("moveThreadToMailbox:", "archive");
3
}

Now in MailMate’s preferences I just need to add my own keybindings:

Also using the GMail custom bindings. Those are separated by a comma, incidentally.

And now hitting ⇧e will archive an entire thread, just like we wanted.


  1. Also, MailMate features “distortion mode”, in case you want to take screenshots for the internet, like I’m about to do. Bonus points! 

  2. Taken from MailMate’s Gmail keybindings file