2

I've got a WQHD (1440p) Monitor hooked up to my 13 inch MacBook Pro when I'm sitting at my desk. Love the high resolution (much screen real estate) but sometimes I find myself toggling Safari's Zoom to 125%: enter image description here

Is there an option to toggle this setting by Script/Terminal Command or else automatically? If so I could toggle it automatically when connecting the monitor with Control Plane.

This code gets to the right settings tab, but I can’t figure out how to set the zoom level:

tell application "System Events"
    tell application process "Safari"
        set frontmost to true
        keystroke "," using command down
        delay 1
        tell window 1
            click button "Advanced" of toolbar 1 of it
            delay 1
            keystroke "w" using command down
        end tell
    end tell
end tell
  • Is Cmd/+ not doing what you need? – Tetsujin Jun 9 '17 at 9:16
  • cmd + / cmd + - does not sets the default zoom for all pages. – kbecker87 Jun 9 '17 at 12:46
3

This Applescript code sets the zoom level globally:

tell application "System Events"
    tell application process "Safari"
        set frontmost to true
        keystroke "," using command down
        delay 0.5
        tell window 1
            click button "Advanced" of toolbar 1 of it
            click pop up button 3 of group 1 of group 1 of it
            click menu item 4 of menu 1 of pop up button 3 of group 1 of group 1 of it
            keystroke "w" using command down
        end tell
    end tell
end tell

change menu item 4 to 5 for a 115% or 6 for 125% zoom level.

Using an Applescript is better than using cmd + / cmd + - because it sets the default zoom for all pages.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .