Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Customize default window size and zoom #1613

Open
esimkowitz opened this issue Dec 23, 2024 · 6 comments
Open

[Feature]: Customize default window size and zoom #1613

esimkowitz opened this issue Dec 23, 2024 · 6 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@esimkowitz
Copy link
Member

esimkowitz commented Dec 23, 2024

Feature description

Add a configuration to override the default new window size and zoom so users with larger/smaller monitors can get the best experience.

Implementation Suggestion

Add window:dimensions setting with a string value {X}x{Y} where the units are pixels. This can be applied in emain-window.ts when the Electron BaseWindow object gets initialized.

Add window:zoom setting with a float value that defaults to 1. This can be applied in emain-tabview.ts, where the WebContentsView gets initialized. This can be overridden by different tabs too.

Anything else?

No response

@esimkowitz esimkowitz added enhancement New feature or request good first issue Good for newcomers triage Needs triage labels Dec 23, 2024
@zaidnadaff
Copy link
Contributor

Hi, can I work on this?

@esimkowitz
Copy link
Member Author

Of course! Assigning to you

@esimkowitz
Copy link
Member Author

Updated the ask for window:zoom, to match what Electron expects, this should probably be a float value instead of an integer

@zaidnadaff
Copy link
Contributor

zaidnadaff commented Dec 27, 2024

Hey @esimkowitz I'm sorry for asking as I am new to this.

For the first part of making sure that window size gets overridden, a combination of ScaleFactor and relative views like percentage can be used? ScaleFactor makes sure that the physical and logical pixels of devices with different resolutions maintain a uniform view.

For the zoom, I did not quite what get the requirement is.

Also, I noticed another error, when zooming out, when I was pressing ctrl + '-' continuously, the app crashed.

Screenshot from 2024-12-27 10-17-04

this was fixed when I replaced this code

if (wc.getZoomFactor() <= 0.2) { return; } wc.setZoomFactor(wc.getZoomFactor() - 0.2);

with this

wc.setZoomFactor(Math.max(0.2, wc.getZoomFactor() - 0.2));

@esimkowitz
Copy link
Member Author

esimkowitz commented Dec 27, 2024

Yeah that new logic makes sense to me, good catch! Could you do the same for the zoom in logic? Also could you consolidate those zoom functions in menu.ts so they don't duplicate logic?

@esimkowitz
Copy link
Member Author

esimkowitz commented Dec 27, 2024

I think for the default zoom factor, it's just whatever the user defines is the default when a new window gets created and the value we set it back to when they use the Cmd:0 keyboard shortcut. We should let them still zoom in/out manually

esimkowitz pushed a commit that referenced this issue Dec 30, 2024
fixed issue #1613 partially, 

added window:dimensions as a setting which gives the user to define
dimensions.

fixed the zoom in and out logic to prevent the app from crashing.

Had issues with getting setting zoomfactor in emain-tabview.ts. will fix
it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants