objective c - Hide mouse cursor on OS X after a few seconds -


For my fullscreen app, I want to hide the cursor after a few seconds if it does not go away, then in QuickTime the fullscreen mode Like or iTunes Probably I'm looking to call [NSCursor setHiddenUntilMouseMoves: Yes] , but how do I know when to call?

Maybe I'm for that, but Mac. I could not find any way to get the same "idle time" (plus, I probably do not care about keyboard events, just mouse movement).

You can get time (cursor if you want the keyboard): CGEventSourceSecondsSinceLastEventType (kCGEventSourceStateCombinedSessionState, kCGEventMouseMoved)

Swift 3 code : CGEventSource.secondsSinceLastEventType (CGEventSourceStateID) .combinedSessionState, eventType: CGEventType.mouseMoved)

Also see. You probably have to choose this function every two seconds, and you should assume that if the time has passed after the user moves the cursor, it has reduced it.


Comments