Skip to content

Instantly share code, notes, and snippets.

@pudquick
Created December 23, 2015 19:12
Show Gist options
  • Save pudquick/350ba6411df3be77d32a to your computer and use it in GitHub Desktop.
Save pudquick/350ba6411df3be77d32a to your computer and use it in GitHub Desktop.
Programmatically immediately lock the screen of a Mac running OS X, regardless of security settings, screensaver settings, or Fast User Switch settings
from ctypes import CDLL
loginPF = CDLL('/System/Library/PrivateFrameworks/login.framework/Versions/Current/login')
result = loginPF.SACLockScreenImmediate()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment