jamielinux / default-zoom

Set default zoom level for Firefox
MIT License
26 stars 7 forks source link

Control+0 should reset to preferred zoom level instead of 100% #1

Open DarwinAwardWinner opened 5 years ago

DarwinAwardWinner commented 5 years ago

This extension correctly sets the zoom level upon loading a website, but pressing control+0 always sets the zoom level to 100%. It would be nice if this extension modified that shortcut to set the zoom level to the preferred default instead.

jamielinux commented 5 years ago

Hi @DarwinAwardWinner, thanks for your feature request!

I like the idea, but I'm not sure that WebExtensions allow you to override default keyboard shortcuts.

I couldn't find anything definitive. There's a bug report that seems undecided on whether it should be allowed, and there are reports of inconsistencies across platforms. But I tried it myself (with Firefox on Linux) and couldn't get Ctrl+0 to work; it only seemed to play nice when using a random shortcut Firefox wasn't already using.

A workaround is to:

  1. Enable the Browser Console command-line.
  2. Open the Browser Console.
  3. Run FullZoom._cps2.setGlobal(FullZoom.name,1.33,gBrowser.selectedBrowser.loadContext); where 1.33 is the zoom level you want Ctrl-0 to reset things to (in this case 133%).
DarwinAwardWinner commented 5 years ago

I wonder if you could write a user script script to run this on every startup. (I assume the user would have to set it up manually, since the extension itself doesn't have the permissions.)

jamielinux commented 5 years ago

After you run that command, the setting persists after you close Firefox which is handy :) And as a bonus you get Ctrl+0 that does the Right Thing. The problem is, as you correctly mentioned, you can't do exactly the same with an extension.