How to specify where new program window appears?

1

When I open pdf using Preview I want the Preview window to be placed in the right upper corner not in the left one.

Any idea how I can do that?

OS X 10.6.2

Radek

Posted 2011-01-25T04:20:26.617

Reputation: 2 914

Answers

3

Windows are positioned from some starting position (e.g. near the top left) and every subsequent window is positioned slightly to the right.

This mode of positioning is hard-coded in applications (or, more likely, the Apple frameworks these applications use). You'd need to modify Preview itself. There's no preference for this: The preferences Just Jake mentions are not related to document viewer windows, but for all windows that exist only once (color picker, preferences, etc.).

Unfortunately, Preview is no longer AppleScriptable, so I don't think it's possible to write an AppleScript that moves the window around.

Have a look at third party window handling software such as SizeUp and Cinch or MercuryMover.

Daniel Beck

Posted 2011-01-25T04:20:26.617

Reputation: 98 421

2

I am not sure that this application could save the preference then brings it up when other app (Preview, in your case) starts up or not but I think it's quite useful with shortcut control. I think you could run Preview and spend a couple mins with the keyboard to set it up exactly where you want on the screen.

The application is Divvy

Ngoc Pham

Posted 2011-01-25T04:20:26.617

Reputation: 478

2

Preview appears to store the size and shape of windows in its .plist preference file. Reading the file using defaults read com.apple.Preview reveals a few keys that may affect the placement of windows:

"NSWindow Frame NSColorPanel" = "565 312 201 323 0 0 1680 1028 ";
"NSWindow Frame NSFontPanel" = "1220 688 445 270 0 0 1680 1028 ";
"NSWindow Frame PVImageCorrection" = "809 531 326 405 0 0 1680 1028 ";
"NSWindow Frame PVInspectorPanel" = "1360 903 320 121 0 0 1680 1028 ";
"NSWindow Frame PVPSConverterWindowFrame" = "273 142 340 296 0 0 1680 1028 ";
"NSWindow Frame PVPreferences" = "590 345 500 341 0 0 1680 1028 ";

These keys must be relevant to the display because I'm running at 1680 by 1050, which is actually 1680 by 1028 once you subtract 22 pixels for the menu bar.

I'd suggest playing around with these keys in the .plist file using either defaults or a plist editor. You can find the preference file in ~/Library/Preferences/com.apple.Preview.plist

Alternatively, if you feel comfortable scripting via AppleScript, You can move an application's windows around programmatically once you've enabled access for assistive devices.

Just Jake

Posted 2011-01-25T04:20:26.617

Reputation: 688

These do not actually control the most important document window. – Daniel Beck – 2011-06-23T08:04:03.530

1

tell app "Finder"
    set {0, 0, dtw, dth} to bounds of window of desktop
    try
        set sel to selection
    on error
        return
    end try
    repeat with f in sel
        try
            open f
        end try
    end repeat
end tell
if application "Finder" is frontmost then return
try
    tell app (path to frontmost application as text)
        set bounds of window 1 to {dtw / 2, 22, dtw, dth}
    end tell
end try

It's only really useful if you:

  • Already use split-screen windows a lot
    • ShiftIt is an extremely simple free alternative
  • Often open files with Finder

I currently have scripts like this assigned to ⇧⌘-numpad (in Finder only), and the regular split-screen ones to -numpad.

There are some utilities that allow setting default dimensions per application. FinderMinder repositions all new Finder windows after opening them. (There's a visible delay.) Breeze just allows assigning shortcuts for saving and restoring default dimensions.

Still, I'd also be interested in methods to change the default size / position / side of screen / stacking behavior of new windows.

Lri

Posted 2011-01-25T04:20:26.617

Reputation: 34 501