-- Screen-Lock.applescript
-- Screen-Lock
-- Created by Andrew James on 28/02/07.
-- Copyright 2007 semaja2.net. All rights reserved.
on launched theObject
tell user defaults
make new default entry at end of default entries with properties {name:"idleTime", content:60}
end tell
end launched
on idle theObject
set idleTime to (do shell script "ioreg -c IOHIDSystem | perl -ane 'if (/Idle/) {$idle=(pop @F)/1000000000; print $idle,\"\";last}'") as integer
--log idleTime
if idleTime > (content of default entry "idleTime" of user defaults) then
set normalCommand to "/System/Library/CoreServices/Menu\\ Extras/User.menu/Contents/Resources/CGSession -suspend"
do shell script normalCommand
end if
return 5
end idle
I don't get the part about hiding it.
EDIT: Yup, I definitely must be missing something about making it hidden, because this isn't working:
View attachment 69246
I also tried String = 1, and Boolean = Yes
It was no problem, already had most the code lying around here, and i do agree OSX needs some of the features from windows such as the handy "win+l" to lock the screen
My solution uses the above code to lock the screen but i use quicksilver to run the script.
I dont think we should have to waste menubar real estate on fast user switch just to lock the screen, or enable the screen saver to lock the screen
Make sure your editing the correct info.plist, the one your looking for unless your recompiling in xcode is the file inside Screen-Lock.app
So select the application and select "Show Package contents"
PS. to edit the idle time (60 sec by default) use the following command in terminal
defaults write com.semaja2.Screen-Lock idleTime <time in seconds>
PSS. Its a number for the setting:
<key>LSUIElement</key>
<integer>1</integer>