Jump to content

Alfred workflow for re-adjusting chrome windows zoom.

Recommended Posts

I am using my laptop with an external monitor. 
Laptop has a 720p screen (non-retina macbook pro) (lol) and external monitor's resolution is 2560x1440. 
So everytime I connect and disconnect my laptop, I gotta adjust the size of web pages. 
On my laptop I use zoom in 100% and on my external display I use 150%. 
Otherwise the texts are gonna be too small. 
Is there an alfred workflow can let me do this?
It is getting annoying having to adjust manually every single time. 

Link to comment

According to Chromes’s AppleScript dictionary, you can’t zoom windows with it, only check if windows are already or can be zoomed.

Two solutions:

  • Add a Dispatch Key Combo Output to press ⌘+ and ⌘0 (Chrome’s zoom keyboard shortcuts).
  • Use (disclaimer: I’m the author) to zoom the pages. Use the code (function(){document.body.style.zoom = "150%"})() to zoom in, and (function(){document.body.style.zoom = "100%"})() to zoom out. Here’s a ready-made workflow.

The first method is more prone to errors (especially since to zoom to 150% you need to ⌘+ three times in a row) because it relies on faking keyboard presses. But the second method requires you to activate it on each page. Pick whichever is more convenient to your usage.

Edited by vitor
Link to comment
  • 4 years later...
  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...