Skip to content

Instantly share code, notes, and snippets.

@pepijndevos
Created March 30, 2010 19:19
Show Gist options
  • Save pepijndevos/349472 to your computer and use it in GitHub Desktop.
Save pepijndevos/349472 to your computer and use it in GitHub Desktop.
from Quartz import *
def MyFunction(*args):
print args
tap = CGEventTapCreate(kCGHIDEventTap, kCGHeadInsertEventTap, kCGEventTapOptionListenOnly, kCGEventLeftMouseDown, MyFunction, None)
runLoopSource = CFMachPortCreateRunLoopSource(None, tap, 0)
CFRunLoopAddSource(CFRunLoopGetCurrent(), runLoopSource, kCFRunLoopDefaultMode)
CGEventTapEnable(tap, True)
print tap
print runLoopSource
#CFRunLoopRun()
CFRunLoopRunInMode(kCFRunLoopDefaultMode, 20, False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment