OS X 10.11 ‘El Capitan’ added a new feature to Mail.app Swipe to manage your inbox:

Swipe to manage your inbox.

Now you can take care of your email with a swipe, just like on your iOS devices. Need to triage your inbox? Swipe right to mark an email as read or unread, or swipe left to delete. You’ll be focused on what’s important in no time.

Swipe To Delete

I find this new feature extremely annoying as I keep triggering it by accident. Sadly it seems that there is no preference (even secret preference) to disable this feature. But the good news is that Mail.app supports plugins.

Want to support this blog? Please check out

MarkChart
To disable this feature, I created a simple Mail.app plugin. A precompiled version for Mail 9.3 (3124)

(OS X 10.11.4) can be downloaded here: DisableSwipeGesture.mailbundle.zip

You can download the source code here : Download ‘DisableSwipeGesture’ Source Code

Installation using the precompiled version for Mail 9.3 (3124) - OS X 10.11.4:

  • Download the precompiled version
  • Unzip
  • Copy the file into ~/Library/Mail/Bundles/
  • Relaunch Mail.app

Installation for other versions of Mail.app:

  • Download the DisableSwipeGesture source code
  • Open the project in Xcode
  • Build
  • Relaunch Mail.app

How does it work?

Mail.app uses a standard NSTableView to support the swipe to delete gesture. It implements the AppKit -tableView:rowActionsForRow:edge: delegate method to add the swipe to delete feature.

Before handling a swipe event, AppKit checks if swipe to delete is supported with the internal method -(BOOL)[NSTableView _allowSwipeToDeleteForEvent:]. The default implementation checks if the NSTableView is a view based tableview and if there is a delegate. The DisableSwipeGesture Mail plugin overrides this internal method to always return NO i.e. to never allow swipe to delete. Note that this plugin only changes the behavior of Mail.app, it does not affect any other app. However the same mechanism could be used to disable the swipe to delete feature for any OS X app supporting plugins.

Mail.app plugin compatibility

Before loading any plugin, Mail.app checks if the plugin’s Info.plist contains the current Mail.app PluginCompatibilityUUID value. If this is not the case, Mail.app will refuse to load the plugin and you will see an alert:

Incompatible Plugin

If you use this ‘DisableSwipeGesture’ plugin and you update Mail.app though an OS X update, you will need to update the PluginCompatibilityUUID value in the Info.plist of the DisableSwipeGesture plugin. The simplest solution is to recompile the plugin using the steps provided in ‘Installation for other versions of Mail.app’. The Xcode project has a build phase that will extract the PluginCompatibilityUUID from /Application/Mail.app and copy it into the Info.plist.