You could have a look at the event object e. If the event was triggered by a real click, you'll have things like clientX, clientY, pageX, pageY, etc. inside e and they will be numbers; these numbers are related to the mouse position when the click is triggered but they will probably be present even if the click was initiated through the keyboard. If the event was triggered by $x.click() then you won't have the usual position values in e. You could also look at the clientX0, that shouldn't be there if the event came from $x.click().
Maybe something like this:
$("#foo").click(function(e){
if(e.hasOwnProperty('originalEvent'))
// Probably a real click.
else
// Probably a fake click.
});
DOM Level 3 specifies event.isTrusted. This is only currently supported in IE9+ and Firefox (based on my tests. I've also read (although not thoroughly researched) that it can be overridden in some browsers and is probably not yet 100% ready to actually be trusted (unfortunately).
This is a modified version of @mu's fiddle that works on IE and Firefox.
Not going to participate in the intellectual discussion, the code which worked for me to filter .click() and .trigger('click') is-
$(document).on('click touchstart', '#my_target', function(e) {
if (e.pageX && e.pageY) { // To check if it is not triggered by .click() or .trigger('click')
//Then code goes here
}
});