-
-
Notifications
You must be signed in to change notification settings - Fork 715
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
Added a default zoom level setting for new tabs #2490
base: master
Are you sure you want to change the base?
Conversation
… the settings.html page
@@ -39,7 +40,8 @@ var webviewGestures = { | |||
return this.zoomWebviewBy(tabId, -0.2) | |||
}, | |||
resetWebviewZoom: function (tabId) { | |||
webviews.callAsync(tabId, 'zoomFactor', 1.0) | |||
const defaultZoomLevel = parseFloat( settings.get('defaultZoomLevel') || '1' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be possible to store the setting value directly as a number, so we wouldn't need to parse the string.
@@ -51,6 +51,16 @@ function onNavigate (tabId, url, isInPlace, isMainFrame, frameProcessId, frameRo | |||
} | |||
} | |||
|
|||
// set default zoom level for tab | |||
function setTabDefaultZoomLevel (tabId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't working for me. I think the issue is that when it's called from webviews.add
, the view object hasn't been created in the main process yet, so calling view.setZoomFactor isn't doing anything.
Another thing to consider is how this interacts with user-set zoom levels. For example, right now, if I open Github and zoom it to 150%, Electron will remember that and set the zoom to 150% on my next visit. It seems like this would reset that back to my default zoom level, which seems undesirable.
It looks like webPreferences has a zoomFactor option that can be used to do this instead: https://www.electronjs.org/docs/latest/api/structures/web-preferences. That might work better with custom zoom levels.
(the webPreferences object is created in viewManager.js)
@@ -159,6 +159,7 @@ | |||
"settingsUserscriptsToggle": "Enable user scripts", | |||
"settingsShowDividerToggle": "Show divider between tabs", | |||
"settingsLanguageSelection": "Language: ", | |||
"settingsDefaultZoomLevel": "Default zoom", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"settingsDefaultZoomLevel": "Default zoom", | |
"settingsDefaultZoomLevel": "Default zoom:", |
Added a default zoom level setting for new tabs.
Fixed some IDs on the settings.html page.