-
-
Save pypykim/92665b39970ea559743d to your computer and use it in GitHub Desktop.
Revisions
-
typcn created this gist
Mar 29, 2016 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ extern void SACLockScreenImmediate ( ); SACLockScreenImmediate(); 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ io_registry_entry_t r = IORegistryEntryFromPath(kIOMasterPortDefault, "IOService:/IOResources/IODisplayWrangler"); if (r) { IORegistryEntrySetCFProperty(r, CFSTR("IORequestIdle"), kCFBooleanFalse); IOObjectRelease(r); } NSString *pw = [SSKeychain passwordForService:@"login" account:@"login"]; NSString *s = @"tell application \"System Events\"\n\ tell application \"ScreenSaverEngine\" to quit\n\ delay 0.5\n\ keystroke \"%@\"\n\ keystroke return\n\ end tell"; NSDictionary *err; NSAppleScript *script = [[NSAppleScript alloc] initWithSource:[NSString stringWithFormat:s,pw]]; [script executeAndReturnError:&err];