Q:

How to detect clicks on empty space via python?

To elaborate - I want a setup where LMB clicking (in the LMB to select setup) on an empty space in the 3D View causes all of the mesh to be deselected when in Edit Mode, all objects when in Object mode, etc. I specifically would like to do it via an addon, but any help is appreciated.

A:

It's actually really simple:

Go to User Preferences > Input and change the filter type from Name to Key-Binding
Search for action and find the 3D View category
Change view3d.cursor3d to object.select_all
Set Action to Deselect

Clear search filter
Expand 3D View > Mesh and Add New
Set it to mesh.select_all and Deselect
Bind it to Mouse, Action and Press

