[MacTUG] SafariFullScreen but not "Full Screen"

Dani Roloson daroloso at uwaterloo.ca
Tue Apr 28 17:03:38 EDT 2015


If you want to get the monitor bounds dynamically, the experts seem to say that Quartz Display Services is the only reliable method which seems to involve writing some Swift or Obj-C.

https://developer.apple.com/library/mac/documentation/GraphicsImaging/Reference/Quartz_Services_Ref/index.html#//apple_ref/c/func/CGDisplayBounds

________________________________
http://macscripter.net/viewtopic.php?id=22413
is a forum thread "Strech (sic) any front window to maximum size"
which is 8 years old but does caution that some apps may not play nice.
________________________________
So the following AppleScript is specific to my monitors

and Safari (but that can be fixed by removing the tell/end tell)


It could be the starting for a left/right/top/bottom half as well.

Probably want an Automator Service so in contextual menus

and can be assigned a keyboard shortcut.


-- figure out your bounds for each display after manually sizing a window

--

-- tell application "Safari"

-- get bounds of front window

-- end tell

--

-- {0, 22, 1919, 1032} -- main display (22 is for menu bar)

-- {1920, 0, 3520, 1200}  -- second display (not running 10.10 so no menu bar)


tell application "Safari"

set screenResolution to bounds of front window

set xAxis to item 1 of screenResolution

if xAxis < 1920 then

set the bounds of the first window to {0, 22, 1919, 1032}

else

set the bounds of the first window to {1920, 0, 3520, 1200}

end if

end tell

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.uwaterloo.ca/pipermail/mactug/attachments/20150428/44de1b8f/attachment-0001.html>


More information about the MacTUG mailing list