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

dpaanlka

macrumors 601
Original poster
Nov 16, 2004
4,868
30
Illinois
Is it possible to set the computer to not log you out, but just return you to the login screen after a certain amount of time?
 

GimmeSlack12

macrumors 603
Apr 29, 2005
5,403
12
San Francisco
The only way I know to do it is have the Quick Switch User icon in the menu bar, under that menu has the Login Window option. Takes you to the login window without logging you out.

As for going to that window automatically after a certain amount of time you'll have to explore. Or use a screensaver password feature.
 

semaja2

macrumors 6502a
Dec 12, 2005
576
18
Adelaide
This is actually possibly using AppleScript and some perl/doshellscript

Ill see what i can come up with.

Edit: Well that took less time then expected

heres the code:

Code:
-- 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

and heres the application/project file, the application can be hidden by adding the LSUIElement = 1 into the info.plist
 

Attachments

  • Screen-Lock.zip
    30.6 KB · Views: 217

dpaanlka

macrumors 601
Original poster
Nov 16, 2004
4,868
30
Illinois
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:

Picture 3.png

I also tried String = 1, and Boolean = Yes
 

semaja2

macrumors 6502a
Dec 12, 2005
576
18
Adelaide
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

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>
 

semaja2

macrumors 6502a
Dec 12, 2005
576
18
Adelaide
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
 

pianoman

macrumors 68000
May 31, 2006
1,963
0
if you don't want to tinker around your system's insides, you might want to try WinSwitch. this requires a menubar icon and manual action, though - it's not automatic.
 

kenyabob

macrumors regular
Jul 13, 2003
127
0
San Francisco
thank you so much

Ive been looking for something that could do this for a while, and using this script with iBackground Scripts is the perfect solution. Thanks so much!
 

psxguru

macrumors 6502a
May 19, 2006
512
0
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

While I agree there should be a dedicated lock screen function, you can easily imitate it without having to use scripts.

So long you have the 'require password after sleep/screen saver' enabled in security system preferences. You can then press CTRL SHIFT EJECT to sleep the display or have hot corners setup with one corner being sleep display.
Admittedly it relies on the screen saver security but it's not a major hassle.
 

kenyabob

macrumors regular
Jul 13, 2003
127
0
San Francisco
I share this computer with my girlfriend. I setup her own account, but unless the she remembers to hit 'switch user' when she is prompted for my password on wake — she'll simply put in my password and use my account.

Another poster here has a similar issue with his kid. Unless you can make sure to remind other users on your machine to always hit the switch user button, or to the keyboard shorcut you posted, chances are, they are simply going to use the account of whoever is logged in already.
 

NicoleRichie

macrumors 6502
Jun 30, 2007
435
1
Wirelessly posted (Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_2_1 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148a Safari/6533.18.5)

Just set a hot corner in you sleep settings for screen lock.
 

lineskc

macrumors newbie
Nov 17, 2013
1
0
Clarification

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>

I know this is a REALLY OLD post, but it has been very helpful in for me in allowing me to have my computer auto-return to the login window. I am not really familiar with all the code-writing info presented, so I was wondering if you could provide clarification on how to edit the idle time? I'm not sure where to put that, what to put, etc.
Thank you
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.