1

Every time I open a new local file, the zoom level is reset to 100%. Is there a way/extension to make the default a different zoom percent?

It'd be even better (but not required) if I could set this per file path. e.g., all C:/docs files open at 500%. The rest would be at 100%.

4

1 Answer 1

3

I had the same problem. Some options:

  • Install Tampermonkey, this is a Firefox extension to run your own Javascript code on websites of your choice.

    Then you can make a script like this:

    // ==UserScript==
    // @name         Zoom Qt docs
    // @match        file:///C:/qt/Docs/*
    // @grant        GM_addStyle
    // ==/UserScript==
    
    var scale = 1.2;
    
    var css = `
        html {
            width: ${100 / scale}%;
            transform-origin: top left;
            transform: scale(${scale});
        }
    `;
    
    GM_addStyle(css);
    

    Text rendering seems to be worse when using this instead of normal browser zoom (Firefox 108), so I do not recommend this.

  • Write a Firefox extension to set the browser zoom level, this seems to be possible with the browser.tabs.setZoom function. I was hoping I could call this function from a Tampermonkey script, but that seems to be impossible.

  • Run a local web server. Let it listen on 127.0.0.1 so it doesn't allow connections from other computers. To have different zoom settings for different sites, make up a hostname for every site and add the hostnames to your hosts file. Let them all point to 127.0.0.1.

    I ended up installing NGINX with this configuration:

    events {}
    
    http {
        server {
            listen 127.0.0.1:80;
            location / {
                root "c:\\";
                autoindex on;
            }
        }
    }
    
1
  • I don't have an eye for these things, but I increased the scale in your first solution to 7x and the text didn't look a worse for me. I vaguely recall turning on svg fonts on Windows years ago, so maybe that's relevant? Mar 31, 2023 at 0:06

You must log in to answer this question.

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