How to maximize `Preview` by keyboard shortcut

keyboardpreview

This question is about the Preview app. I use that a lot to read stuff (PDF files, etc.
Each time it opens, it forgets the last Window state.
On a Retina Mac, it is ideal to have it opened at "Two pages" view (Command-3) in "almost fullscreen" mode: the window as large and wide as possible but keeping the menu, toolbar and dock visible (this is almost distraction free).

The way I do it now is tedious, especially as I have to repeat these steps for every document:

  1. open a document
  2. press Command-3
  3. drag the top-left corner of the Preview window to the left of the screen against the menu bar on the top.
  4. drag the bottom-right corner of the Preview window to the right of the screen against the dock on the bottom.

I'm a software developer. I hate repetitive steps.

How can I either:

  • force Preview to open this way?
  • if Preview can't: by keyboard force Preview to be "almost full screen" with "Two pages" view?
  • bonus: make this work for other applications (like Chrome or FireFox) as well.

Background:

More than a year ago, I switched my host machine from Windows to Mac.
Most things work great (some like battery life and speed of sleep/wake
should be far more advertised), but there are still a few things that
I miss dearly. Most of those have to do with me having had RSI in the
early 90's because of mouse and touchpad usage, so I'm very keyboard
oriented.

Best Answer

To make Preview open PDFs in the "Two Pages" mode, go to Preferences --> PDF, then select the desired mode in the "Show as" menu.

There is no shortcut to go to "Almost Fullscreen Mode" by default, but you can create one:

  • Go to System Preferences --> Keyboard --> Shortcuts;
  • Click "App Shortcuts";
  • Click the "+" button to add a new shortcut;
  • You'll be asked for the menu title you want to link to a shortcut. For the command you want, it is "Zoom";
  • You will also be able to specify whether you want the shortcut to be available in all application or a specific application only.

EDIT: Here's an AppleScript solution to set the first window of Preview (the frontmost opened document of Preview) to the size of the screen (works only with one display connected):

tell application "Preview"
    tell application "Finder" to set screen_resolution to bounds of window of desktop
    set bounds of window 1 to screen_resolution
end tell