File tree 7 files changed +50
-5
lines changed
7 files changed +50
-5
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ export const configSchemata = {
12
12
autoHideMenubar : z . boolean ( ) ,
13
13
autoUpdate : z . boolean ( ) ,
14
14
badgeOption : z . boolean ( ) ,
15
+ useOneZoom : z . boolean ( ) ,
15
16
betaUpdate : z . boolean ( ) ,
16
17
// eslint-disable-next-line @typescript-eslint/naming-convention
17
18
customCSS : z . string ( ) . or ( z . literal ( false ) ) . nullable ( ) ,
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ export type MainMessage = {
5
5
"clear-app-settings" : ( ) => void ;
6
6
"configure-spell-checker" : ( ) => void ;
7
7
"fetch-user-agent" : ( ) => string ;
8
+ 'zoom-other-tabs' : ( zoomLevel : number ) => void ;
8
9
"focus-app" : ( ) => void ;
9
10
"focus-this-webview" : ( ) => void ;
10
11
"new-clipboard-key" : ( ) => { key : Uint8Array ; sig : Uint8Array } ;
@@ -18,6 +19,7 @@ export type MainMessage = {
18
19
"toggle-app" : ( ) => void ;
19
20
"toggle-badge-option" : ( newValue : boolean ) => void ;
20
21
"toggle-menubar" : ( showMenubar : boolean ) => void ;
22
+ "toggle-one-zoom" : ( newValue : boolean ) => void ;
21
23
toggleAutoLauncher : ( AutoLaunchValue : boolean ) => void ;
22
24
"unread-count" : ( unreadCount : number ) => void ;
23
25
"update-badge" : ( messageCount : number ) => void ;
Original file line number Diff line number Diff line change @@ -31,6 +31,8 @@ import {sentryInit} from "./sentry.js";
31
31
import { setAutoLaunch } from "./startup.js" ;
32
32
import { ipcMain , send } from "./typed-ipc-main.js" ;
33
33
34
+
35
+
34
36
import "gatemaker/electron-setup" ; // eslint-disable-line import/no-unassigned-import
35
37
36
38
// eslint-disable-next-line @typescript-eslint/naming-convention
@@ -154,7 +156,6 @@ function createMainWindow(): BrowserWindow {
154
156
app . quit ( ) ;
155
157
return ;
156
158
}
157
-
158
159
await app . whenReady ( ) ;
159
160
160
161
if ( process . env . GDK_BACKEND !== GDK_BACKEND ) {
@@ -259,6 +260,7 @@ function createMainWindow(): BrowserWindow {
259
260
AppMenu . setMenu ( {
260
261
tabs : [ ] ,
261
262
} ) ;
263
+
262
264
mainWindow = createMainWindow ( ) ;
263
265
264
266
// Auto-hide menu bar on Windows + Linux
@@ -278,6 +280,13 @@ function createMainWindow(): BrowserWindow {
278
280
}
279
281
} ) ;
280
282
283
+ ipcMain . on ( 'zoom-other-tabs' , ( event , zoomLevel ) => {
284
+ BrowserWindow . getAllWindows ( ) . forEach ( ( window ) => {
285
+ window . webContents . setZoomLevel ( zoomLevel ) ;
286
+ } ) ;
287
+ } ) ;
288
+
289
+
281
290
ipcMain . on ( "fetch-user-agent" , ( event ) => {
282
291
event . returnValue = session
283
292
. fromPartition ( "persist:webviewsession" )
Original file line number Diff line number Diff line change 1
1
import type { WebContents } from "electron/main" ;
2
2
import fs from "node:fs" ;
3
3
import process from "node:process" ;
4
+ //import { ipcRenderer } from 'electron';
4
5
5
6
import * as remote from "@electron/remote" ;
6
7
import { app , dialog } from "@electron/remote" ;
@@ -158,16 +159,28 @@ export default class WebView {
158
159
this . show ( ) ;
159
160
}
160
161
162
+ private syncZooms ( ) : void {
163
+ // Sync zoom level with other tabs if useOneZoom is enabled
164
+ const useOneZoom = ConfigUtil . getConfigItem ( "useOneZoom" , true ) ;
165
+ if ( useOneZoom ) {
166
+ const zoomLevel = this . getWebContents ( ) . zoomLevel ;
167
+ ipcRenderer . send ( 'zoom-other-tabs' , zoomLevel ) ;
168
+ }
169
+ }
170
+
161
171
zoomIn ( ) : void {
162
172
this . getWebContents ( ) . zoomLevel += 0.5 ;
173
+ this . syncZooms ( ) ;
163
174
}
164
175
165
176
zoomOut ( ) : void {
166
177
this . getWebContents ( ) . zoomLevel -= 0.5 ;
178
+ this . syncZooms ( ) ;
167
179
}
168
180
169
181
zoomActualSize ( ) : void {
170
182
this . getWebContents ( ) . zoomLevel = 0 ;
183
+ this . syncZooms ( ) ;
171
184
}
172
185
173
186
logOut ( ) : void {
Original file line number Diff line number Diff line change @@ -176,6 +176,7 @@ export class ServerManagerView {
176
176
// Default settings which should be respected
177
177
const settingOptions : Partial < Config > = {
178
178
autoHideMenubar : false ,
179
+ useOneZoom : true ,
179
180
trayIcon : true ,
180
181
useManualProxy : false ,
181
182
useSystemProxy : false ,
Original file line number Diff line number Diff line change @@ -132,6 +132,11 @@ export function initGeneralSection({$root}: GeneralSectionProperties): void {
132
132
</ div >
133
133
< div class ="setting-control "> </ div >
134
134
</ div >
135
+ < div class ="setting-row " id ="one-zoom-option ">
136
+ < div class ="setting-description ">
137
+ ${ t . __ ( "Use one zoom for all server tabs" ) } </ div >
138
+ < div class ="setting-control "> </ div >
139
+ </ div >
135
140
< div
136
141
class ="setting-row "
137
142
id ="spellcheck-langs "
@@ -213,6 +218,7 @@ export function initGeneralSection({$root}: GeneralSectionProperties): void {
213
218
` . html ;
214
219
215
220
updateTrayOption ( ) ;
221
+ useOneZoom ( ) ;
216
222
updateBadgeOption ( ) ;
217
223
updateSilentOption ( ) ;
218
224
autoUpdateOption ( ) ;
@@ -263,6 +269,19 @@ export function initGeneralSection({$root}: GeneralSectionProperties): void {
263
269
} ) ;
264
270
}
265
271
272
+ function useOneZoom ( ) : void {
273
+ generateSettingOption ( {
274
+ $element : $root . querySelector ( "#one-zoom-option .setting-control" ) ! ,
275
+ value : ConfigUtil . getConfigItem ( "useOneZoom" , false ) ,
276
+ clickHandler ( ) {
277
+ const newValue = ! ConfigUtil . getConfigItem ( "useOneZoom" , false ) ;
278
+ ConfigUtil . setConfigItem ( "useOneZoom" , newValue ) ;
279
+ useOneZoom ( ) ;
280
+ } ,
281
+ } )
282
+ return ;
283
+ }
284
+
266
285
function updateMenubarOption ( ) : void {
267
286
generateSettingOption ( {
268
287
$element : $root . querySelector ( "#menubar-option .setting-control" ) ! ,
You can’t perform that action at this time.
0 commit comments