Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

arvacker

macrumors member
Original poster
Oct 6, 2011
59
7
Hello,

i know there are many treads on the web on how to enable/disable password prompt after sleep/screensaver, my question is different.
I want to require a password prompt, only when the computer wakes from sleep, not after the screen has been turned off (or the screensaver started).
Situation is the following: Person is working on his MacBook Air connected to Thunderbolt Display, he/she gets a call, computer turns of the screen (but doesn't go to sleep, it keeps the connections live), person ends call and wants to continue to work without having to enter his/her password.
Person leaves his desk, unplugs the air and drops it in his/her bag (putting it to sleep), person arrives at location, opens up Air and is prompted for his/her password.

Note: i'm aware i can set a timeout between screensaver/sleep and requiring a password, but I want it to require a password immediately after sleep and never after display turned off (screensaver started).

Hope you guys can help!

Greetings,

Arne
 
What you probably want is to use SleepWatcher

and have issue the command: /System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend

EDIT: tested it, and it works like a charm.
 
Last edited:
What you probably want is to use SleepWatcher

and have issue the command: /System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend

EDIT: tested it, and it works like a charm.

i'm sorry, i've installed SleepWatcher and issued the command, but that just makes my computer ask for my password.
How would i have to set it up exactly for my computers to work the way I intend? (turn screen off after 15min, put to standby after 60min and only ask for a password when i wake the computer from standby, so after 60min)
should I put a command/script somewhere to ask for the password after 60min?
(I'm quite good with OSX, but i'm fairly new to terminal and scripting)

Thank you for you help so far, i appreciate it!

Arne
 
Then I don't know what you want my friend. When I installed this, my screensaver would not ask for a password, but putting the computer to sleep would present me with the login screen after waking up.

Did you read the instructions on how to set it up? That command needs to be issued by sleep watcher, not by you. You need to configure sleep watcher to issue that command when your computer goes to sleep.

Sidenote: you need to configure sleep watcher as a user service; this command only works when it's issued by the user that is logged on, so sleep watcher needs to be running as the user. That's in the second part of the read me.
 
Then I don't know what you want my friend. When I installed this, my screensaver would not ask for a password, but putting the computer to sleep would present me with the login screen after waking up.

Did you read the instructions on how to set it up? That command needs to be issued by sleep watcher, not by you. You need to configure sleep watcher to issue that command when your computer goes to sleep.

Sidenote: you need to configure sleep watcher as a user service; this command only works when it's issued by the user that is logged on, so sleep watcher needs to be running as the user. That's in the second part of the read me.

alright, I've configured sleepwatcher, when I use the default rc.sleep and rc.wakeup scripts that come with the program, it works. I just don't know where to enter the command you propose. Is it in the rc.sleep file? if so, then where in this file? I'm terribly sorry to keep bothering you, I have little to no experience with unix scripts/terminal.

I've tried it like this:

for user in `echo 'show State:/Users/ConsoleUser' | scutil | awk '/kCGSSessionUserNameKey/ { print $3 }'`; do
home=`eval echo ~$user`
if [ -x "$home/.sleep" ]; then
logger -t $0 "executing .sleep of user $user"
“excecuting /System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend”
su - $user -c "$home/.sleep"
fi
done

and like this:

for user in `echo 'show State:/Users/ConsoleUser' | scutil | awk '/kCGSSessionUserNameKey/ { print $3 }'`; do
home=`eval echo ~$user`
if [ -x "$home/.sleep" ]; then
logger -t $0 "executing .sleep of user $user"
su - $user -c "$home/.sleep"
/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend
fi
done

(this is in the rc.sleep file)

thanks again for your help.

Arne
 
Yosemite

What you probably want is to use SleepWatcher

and have issue the command: /System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend

EDIT: tested it, and it works like a charm.

I tried this but it does nothing at all.

Anyone knows a way to do this in Yosemite?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.