Skip to content

Instantly share code, notes, and snippets.

@n8felton
Forked from pudquick/beamsync.py
Last active August 29, 2015 14:24
Show Gist options
  • Save n8felton/f9bd2bfbc858fe4e4fe6 to your computer and use it in GitHub Desktop.
Save n8felton/f9bd2bfbc858fe4e4fe6 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import ctypes, ctypes.util
# Import CoreGraphics as a C library, so we can call some private functions
c_CoreGraphics = ctypes.CDLL(ctypes.util.find_library('CoreGraphics'))
def disable_beam_sync(doDisable):
if doDisable:
# Disabling beam sync:
# 1st: Enable Quartz debug
err = c_CoreGraphics.CGSSetDebugOptions(ctypes.c_uint64(0x08000000))
# 2nd: Set beam sync to disabled mode
err = c_CoreGraphics.CGSDeferredUpdates(0)
else:
# Enabling beam sync:
# 1st: Disable Quartz debug
err = c_CoreGraphics.CGSSetDebugOptions(0)
# 2nd: Set beam sync to automatic mode (the default)
err = c_CoreGraphics.CGSDeferredUpdates(1)
# Disable beam sync
disable_beam_sync(True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment