A selectable Zoom Level value of 125% in the Appearance Menu or the possiblity to enter custom Zoom Values in the settings

Use case or problem

I try to customise Obisidian 1.0.3 and the Zoom Level in Settings > Appearance > Advanced has only a fixed amount of possible Settings.

Proposed solution

I use obsidian on a 27" 5k HiRes Display and 120% is kind of too small and 131% kind of too big. A value in between would be optimal for legibility on my device.

I assume the selectable Values are an Array of numbers. I would add the value 125 in between 120% and 131%.

Another more extensive solution would be to enable the input of custom values for the Zoom setting.

Current workaround (optional)

Squinting my eyes. Not cool :c

Related feature requests (optional)

1 Like

Here’s an inconvenient workaround for you: How to change the window zoom level in Electron Framework | Our Code World
Run the command in the Developer Tools console:

const {webFrame} = require('electron')

// Set the zoom factor to 125%
webFrame.setZoomFactor(1.25);

If motivated, you could turn that into a plugin.

2 Likes

Thanks for the workaround and believing in me :smile:, but i can only do a bit of html and css. I don’t think its enough to be able to create a plugin out of that.

1 Like

In that case, you can use an existing plugin.

For example, if you have Templater installed, you could create a template called “Change zoom level” which contains

<%*
    const {webFrame} = require('electron')
    
    let zoom = '';
    while (!zoom.match(/^\s*[\d.]+%?\s*$/)) {
        zoom = await tp.system.prompt("Zoom level (e.g, 125 or 1.25):", "", true);
    }
    zoom = zoom.replace(/^\s*([\d.]+)%?\s*$/, '$1');
    if (zoom >= 10) {
        zoom /= 100;
    }

    webFrame.setZoomFactor(parseFloat(zoom, 10));
    throw new Error(`Zoom level set to ${zoom}`);
%>

There may be more elegant ways to do this without having an error notification at the end. I just don’t know other plugins.

If you want to set the zoom upon start, you can just put similar code in the JavaScript Init plugin (haven’t tried it but should be straightforward).

1 Like

Thank you @obseqious for posting this, i hope this didn’t take too much of your time.
My personal workaround for the issue with a more caveman-like approach consisted on downgrading back to a version with the old interface.

Nah it took little time as I’ve already do lots of similar things with Templater.
And I needed to invest in learning how to invoke arbitrary JS for other future needs

1 Like