Created
June 15, 2016 17:14
-
-
Save pudquick/097f97f4cb67c554f04dba6b5a09a506 to your computer and use it in GitHub Desktop.
Locking the screen immediately with pyobjc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import objc | |
from Foundation import NSBundle | |
login_bundle = NSBundle.bundleWithPath_('/System/Library/PrivateFrameworks/login.framework') | |
functions = [('SACLockScreenImmediate', '@'),] | |
objc.loadBundleFunctions(login_bundle, globals(), functions) | |
# Lock the screen regardless of security settings or who is logged in | |
result = SACLockScreenImmediate() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment