Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mouse tracking daemon

I need to write something using Cocoa to surface raw mouse movement data. Optimally, the app would just be a little daemon that would run, passing the data to a socket server which another application could tap into to gain access to the events.

Can anyone point me in the right direction with regard to approach and tools? I am not even sure where to begin with this right now.

like image 737
Raconteur Avatar asked Jun 28 '10 18:06

Raconteur


People also ask

Can mouse movements be tracked?

Companies use security measures called behavioral biometrics that you likely don't know about, like tracking your mouse movements and the typical behavior in your accounts, measuring the angle you typically use your device, and measuring how fast you swipe around an app.

What does tracking mean on a mouse?

Mouse tracking (also known as cursor tracking) is the use of software to collect users' mouse cursor positions on the computer.

Can websites track your mouse?

Hundreds of the world's top websites routinely track a user's every keystroke, mouse movement and input into a web form – even before it's submitted or later abandoned, according to the results of a study from researchers at Princeton University.

Why is my mouse not tracking properly?

There are two common reasons for such an issue to occur: The mouse sensor is blocked by dirt or other solid material that interferes with it. The mouse needs to reset its surface calibration.


1 Answers

The other simple way to do this is to add a global event monitor (10.6 only, however):

id eventHandler = [NSEvent addGlobalMonitorForEventsMatchingMask:NSMouseMovedMask handler:^(NSEvent * mouseEvent) {
  NSLog(@"Mouse moved: %@", NSStringFromPoint([mouseEvent locationInWindow]));
}];

Then when you're done tracking, you do:

[NSEvent removeMonitor:eventHandler];
like image 185
Dave DeLong Avatar answered Oct 23 '22 19:10

Dave DeLong