The default bug view has changed. See this FAQ.

Stop 10.7 from restoring apps after a restart

RESOLVED DUPLICATE of bug 843545

Status

Release Engineering
Platform Support
P3
normal
RESOLVED DUPLICATE of bug 843545
5 years ago
4 years ago

People

(Reporter: philor, Assigned: coop)

Tracking

(Blocks: 1 bug, {sheriffing-untriaged})

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

5 years ago
If you look at the screenshots we take when a test times out, every one on 10.7 will show iCal running, and nearly every one will show the Bluetooth Setup Assistant running (conveniently, we time out a lot in the hidden permaorange suites, so you can look at lots of pictures). We know that we open iCal and leave it running, bug 449763, but that only accounts for it running during whichever hunk of mochitest runs that test, not for everywhere. Every time I've mentioned the Bluetooth Setup Assistant dialog, I've been told that nobody was in the dc at the time who could possibly have been attaching a keyboard.

Well, wups, silly kitty that it is, Lion tries to be helpful by restoring running apps after a restart, even if getting rid of those running apps are a big part of the reason why we were restarting. Casual googling makes it sound like there's a checkbox in the "did you really want to restart?" dialog that may or may not actually work sometimes, and that you can close all apps and then get-info, lock, some plist in a location with a random string of numbers in it, but didn't find any satisfactory answer for automating not getting random apps restarted.
hmm, the article over at http://hints.macworld.com/article.php?story=20110918051930924 suggests that running the following command will turn off the feature.  I don't know how effective this will be when using 'sudo reboot' instead of the graphical reboot tool.

 defaults write com.apple.loginwindow TALLogoutSavesState -bool false
I wonder if using Apple script to uncheck the checkbox on the restart screen would be the way to go.  I know nothing of applescript, but I've cobbled together the following:

tell application "System Events"
	tell process "Finder"
		tell menu bar 1
			click menu "Apple"
			tell menu "Apple"
				click menu item "Restart…" 
			end tell
		end tell
	end tell
end tell

which is enough to bring up the dialog box.  This is where I become lost.
-- Reboot 10.7 without restoring windows
-- Must enable assistive devices
-- sudo touch /private/var/db/.AccessibilityAPIEnabled
-- http://www.codemacs.com/coding/applescript/applescript-key-codes-reference.8288271.htm

tell application "System Events"
	tell process "Finder"
		tell menu bar 1
			click menu "Apple"
			tell menu "Apple"
				click menu item "Restart…"
				tell application "loginwindow" to activate
				key code 49
				key code 52
			end tell
		end tell
	end tell
end tell

This is enough to start the reboot, but not enough to force all applications to quit instead of asking the user whether or not they want to reboot.
Blocks: 449763
(Reporter)

Updated

5 years ago
Duplicate of this bug: 726616
(Assignee)

Comment 5

5 years ago
Has anyone tried the steps by hand with a lion slave to see whether they work first?
(Assignee)

Updated

5 years ago
Assignee: nobody → coop
Priority: -- → P3
Whiteboard: [sheriff-want]
Keywords: sheriffing-untriaged
Whiteboard: [sheriff-want]
Blocks: 843545

Comment 6

4 years ago
I released a patch for this in bug 843545.  This command seems to work 

/usr/bin/defaults write /Library/Preferences/com.apple.loginwindow LoginwindowLaunchesRelaunchApps -bool false
(Assignee)

Comment 7

4 years ago
(In reply to Kim Moir [:kmoir] from comment #6)
> I released a patch for this in bug 843545.  This command seems to work 
> 
> /usr/bin/defaults write /Library/Preferences/com.apple.loginwindow
> LoginwindowLaunchesRelaunchApps -bool false

Does it need to be deployed anywhere else, or is this bug now a dupe?

Comment 8

4 years ago
I don't think it needs to be deployed anywhere else.
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 843545
Product: mozilla.org → Release Engineering
You need to log in before you can comment on or make changes to this bug.