Posted on 12-16-2011 07:38 AM
Hello everyone,
This is the only way I found so far to disable ‘Reopen windows when logging back in’ option
http://faizanshaharyar.com/osx-lion-how-to-disable-reopen-windows-when-logging-back-in-option
As far as I can understand - it requires a login hook (that might be overwritten by Casper ones) and it downloads a script from somewhere.
It works on my test machine but I have not tested it with Casper yet, is there a better/safer way to achieve disabling that option in Lion?
Many thanks or your help!
Have a great weekend
Carlo
Casper 8.1 – xServe JSS
Posted on 12-16-2011 08:18 AM
Have you looked at what that script does? It removes the ~/Library/Preferences/ByHost/com.apple.loginwindow.* so anything you might have put in there gets wiped out along with the window restore data. I don't know what else might get stored in there, but be aware that this is what the script does.
#!/bin/bash
echo "#!/bin/bash" > /tmp/loginfix.sh
echo "rm /Users//Library/Preferences/ByHost/com.apple.loginwindow." >> /tmp/loginfix.sh
mv /tmp/loginfix.sh /usr/bin/loginfix.sh
chmod +x /usr/bin/loginfix.sh
defaults write com.apple.loginwindow LoginHook /usr/bin/loginfix.sh
Walter
Posted on 12-16-2011 08:39 AM
I think one only needs to delete the TALAppsToRelaunchAtLogin key
from ~/Library/Preferences/ByHost/com.apple.loginwindow.<UUID>
For my account, there was nothing else in there so when I did a "defaults delete" it removed the entire file.
Walter
Posted on 12-18-2011 01:54 PM
There is also a key in .GlobalPreferences
NSQuitAlwaysKeepsWindows of type boolean and value false
This is the same as un-ticking System Preferences -> General -> Restore windows when quitting and re-opening apps checkbox.
Lisa Davies
ICT Client Services Manager
Saint Ignatius' College, Riverview
Phone: 02 9882 8413
Mobile: 0417 005 735