PDA

View Full Version : Lion: failure to honor setting of "Restore windows when quitting and re-opening apps"




HippoMan
Aug 5, 2011, 04:27 PM
I have noticed an annoying "feature" of Lion, and I'm hoping that someone might have found a workaround.

If I uncheck Preferences->General->Restore windows when quitting and re-opening apps, some of my apps seem to ignore that setting after a restart.

Here's a scenario which illustrates the problem:

1. Uncheck the Preferences setting mentioned above.
2. Open up a few Finder windows.
3. Open up a few Terminal windows.
4. In the Terminal Preferences, disable everything related to Window Groups.
5. Do a Logout or a Restart. Uncheck Reopen windows when logging back in.
6. Relog in.
7. Open one Terminal window.

After step 6, all of the Finder windows which were previously open before Logout or Restart will also reopen. After step 7, all of the Terminal windows which were previously open before Logout or Restart will reopen, in addition to the single Terminal window which is manually opened after login.

The only way I can prevent this from happening to Terminal is to add the following two lines right before the final </dict> tag in /Applications/Utilities/Terminal.app/Contents/Info.plist:

<key>LSUIElement</key>
<string>1</string>

However, this has the undesirable side-effect of not showing anything about Terminal in the menu bar or the dock.

None of this used to happen in Snow Leopard, Leopard, or Tiger. Does anyone know how I can disable this unwanted window-opening-after-relogin behavior in Lion?

Thanks in advance.
.



HippoMan
Aug 6, 2011, 10:19 AM
I got a solution for this problem from the Lion section of the discussion.apple.com site. Here's what I did to fix this problem:


Open Terminal.
Open up a Finder window to a work folder.
In the Finder menu bar, hold down Option and select Go->Library.
Navigate to Saved Application State and open it.
Duplicate the com.apple.Terminal.savedState folder (it will create com.apple.Terminal.savedState copy).
Drag com.apple.Terminal.savedState copy to the work folder.
In the work folder, rename that to com.apple.Terminal.savedState.
Delete all the contents of com.apple.Terminal.savedState in the work folder. In other words, that com.apple.Terminal.savedState folder should now be empty.
Go to Terminal and issue a Quit Terminal.
Depending on your system settings, the com.apple.Terminal.savedState folder might now have disappeared from Library/Saved Application State. If so, that is good. If not, delete com.apple.Terminal.savedState from the Library/Saved Application State folder.
Drag the empty com.apple.Terminal.savedState folder from the work folder to Library/Saved Application State.
Do a Control-Click on this com.apple.Terminal.savedState folder, and select Get Info.
In the Info window, select the Locked checkbox, then close the Info window.


Now, the Terminal application will not save its state on restart, nor at any other time.
.