Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In Mac Chrome, I like to switch the default, global Page Zoom settings from 100% to 125%. I'd like a shortcut to do it quickly instead of needing to go to Settings, click Show Advanced Settings, and finally changing the Web Content Page Zoom.

I wonder if there's a way to create an Automator shortcut / hot key? I'm new to Mac so unsure of these tricks.

To be clear, I already know about changing zoom settings Per Website by clicking Command +/-

share|improve this question
    
In OS X, this setting is saved in ~/Library/Application Support/Google/Chrome/Default/Preferences, a JSON file that you can edit directly. It's the default_zoom_level key. Just need to find a proper way to toggle this externally. –  slhck Jan 28 '13 at 20:50
    
I have no idea how to "toggle this externally". Anyone know how to do this? –  Joe Fletcher Jan 30 '13 at 20:22
    
You could write a shell script to toggle the value of that key in the JSON file, wrap it in an Automator action, and assign a shortcut to that. –  Nathan G. Jan 31 '13 at 1:10
    
How would I do that in a shell script? Do you have a search and replace method that would find that particular value and change it? –  Joe Fletcher Jan 31 '13 at 4:57
add comment

1 Answer

I have to post this as an answer rather than a comment (as I don't have enough rep), but you can use sed and/or awk to find the particular line of text you're looking for and replace the default value with whatever value is needed to zoom to your liking. I looked at my Preferences JSON file, but I didn't seem to have the default_zoom_level key, so I can't tell you exactly how to do it, but I did some tests on a sample file using a variation of this script:

cat PATHTOCHROMEPREFERENCES | sed s/ORIGINALVALUE/NEWVALUE/ | pbcopy | pbpaste > PATHTOCHROMEPREFERENCES

where ORIGINALVALUE is the value is the default 100% zoom and NEWVALUE is whatever you need to enter to zoom to 125%. As I mentioned above, I didn't see the default_zoom_level key in the file I have, so I cannot verify that this will work in this specific file.

The sed command used here should be able to and replace whatever text you want, but I suspect you will need to use awk as well to find the specific line you're looking for, since there seems to be a lot of lines containing default_ in the file.

There is probably a much more elegant way to do this, but I hope my answer helps!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.