Saturday, July 23, 2011 [Tweets] [Favorites]

Preview Regressions in Lion

  1. Some applications I want to remember which documents were open when I quit, but never Preview. To prevent it from opening unwanted documents at launch, you can enter this command in Terminal:

    defaults write com.apple.Preview NSQuitAlwaysKeepsWindows -bool false

    Another good candidate for this treatment is:

    defaults write com.apple.QuickTimePlayerX NSQuitAlwaysKeepsWindows -bool false
  2. Preview opens every PDF in “Continuous Scroll” rather than “Single Page” mode. It will remember the change for a given document, but there seems to be no way to change the default.

  3. The “Move to Trash” feature, which I use all the time, no longer works when only a single document is open. Update (2011-08-10): And, though it does work when there are multiple documents, it messes up the order of the remaining ones.

  4. When trying to work around this, I noticed that it’s no longer possible to make Preview AppleScriptable. Preview has, inexplicably, never been scriptable. However, from 10.4–10.6 it was possible to enable the default Cocoa scripting support via these Terminal commands:

    sudo defaults write /Applications/Preview.app/Contents/Info NSAppleScriptEnabled -bool YES
    sudo chmod a+r /Applications/Preview.app/Contents/Info.plist

    This was sufficient to be able to get at the file of the current document to delete it, change its Finder label, import it into EagleFiler, etc. Under 10.7, modifying the Info.plist file breaks the application’s code signature. I would expect this to cause a harmless warning message in the Console, but it actually causes Preview to crash.

    Update (2011-07-26): See these instructions.

  5. Not exactly a regression, but the swiping gestures for changing pages now seem backwards compared with the rest of the system. Swiping left takes you to the previous page in Preview (or Safari), but it scrolls you to the right and moves you to the next space or full screen application.

14 Comments

"Under 10.7, modifying the Info.plist file breaks the application’s code signature."

This was also true in 10.6, unless I'm massively confused.

"I would expect this to cause a harmless warning message in the Console, but it actually causes Preview to crash."

Did you try re-signing the app with a dummy certificate? If the 10.6 behavior is still extant, that should make Preview.app think it's signed.

@Chucky To clarify, it always broke the code signature, but until 10.7 this did not have any adverse effects. I can indeed sign it with my developer certificate, and that works for my purposes, but unless I’m mistaken there’s no easy to way sign it with a dummy certificate on a stock Mac just by entering a few Terminal commands.

"unless I’m mistaken there’s no easy to way sign it with a dummy certificate on a stock Mac just by entering a few Terminal commands."

At least in 10.6, it just involves a pretty simple trip to Keychain Assistant to create a dummy certificate. Call it "michaelfakecertificate" or any other arbitrary name.

Then, it's just a single Terminal command:

codesign -s michaelfakecertificate -vvvv -f /Applications/Preview.app/Contents/MacOS/Preview

(I find myself sometimes changing the "Application is agent (UIElement)" property for some apps, and in 10.6, breaking codesigning in that way broke those apps ability to play nicely with the Firewall, so I learned that trick, since I don't have a developer cert.)

10.7 may handle things differently, or it may not.

@Chucky That should work, but I was hoping to avoid that GUI step.

I wonder how many, if any, of Apple's stock apps from 10.6 will work booted into 10.7.

For example, if the improvements in Lion's Preview.app don't make up for the loss of the “Move to Trash” feature in your use case, can you just run the Preview.app from 10.6?

(Preview.app isn't likely the top candidate for such a step, but it does seem attractive to me for Address Book and iCal...)

Daniel Jalkut’s post shows that you can use just a hyphen as the signing identity. This avoids the step of creating a dummy certificate. It seems to work, although the man page says that “Significant restrictions apply to the use of ad-hoc signed code.”

[...] least favorite parts of Lion are the new iCal and Address Book, and the page-turning animation and regressions in [...]

Preview is one of the few user-visible sandboxed, containerized applications in 10.7. Scripting not working and it crashing without a valid code signature are both artifacts of it being sandboxed.

TextEdit is the other sandboxed user-visible app.

@Dorian Scripting never worked with Preview, so that part isn’t due to sandboxing.

"defaults write com.apple.Preview NSQuitAlwaysKeepsWindows -bool false"

Alas, this does not seem to work. Nothing I've done yet avoids the problem of Preview opening the last opened doc with a new open. The only way to avoid this, it seems, is to explicitly close all docs before you quit. PITA, really.

Aha! THIS:

defaults write com.apple.Preview NSQuitAlwaysKeepsWindows -int 0

however, DOES work! Yay!

Thanks Michael and David! Has anybody found a solution to #2 Preview opens every PDF in “Continuous Scroll” rather than “Single Page” mode?

I've googled and not found anything. Going into the menu every time is so annoying!

@Rotor The solutions that I found: (1) Use the Keyboard preference pane to assign a keyboard shortcut. (2) Set Skim or PDFpen as the default PDF reader.

[...] still seems to be a regression from the Snow Leopard version. It still can’t remember that I like Single Page mode, and it [...]

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment