@@ -170,6 +170,7 @@ function readAuthKey() {
170170 return authKeyStr . trim ( ) ;
171171}
172172
173+ let cmdOrAlt = process . platform === "darwin" ? "Cmd" : "Alt" ;
173174let menuTemplate = [
174175 {
175176 role : "appMenu" ,
@@ -198,9 +199,41 @@ let menuTemplate = [
198199 { role : "reload" , accelerator : "Option+R" } ,
199200 { role : "toggleDevTools" } ,
200201 { type : "separator" } ,
201- { role : "resetZoom" } ,
202- { role : "zoomIn" } ,
203- { role : "zoomOut" } ,
202+ {
203+ label : "Actual Size" ,
204+ accelerator : cmdOrAlt + "+0" ,
205+ click : ( ) => {
206+ if ( MainWindow == null ) {
207+ return ;
208+ }
209+ MainWindow . webContents . setZoomFactor ( 1 ) ;
210+ MainWindow . webContents . send ( "zoom-changed" ) ;
211+ } ,
212+ } ,
213+ {
214+ label : "Zoom In" ,
215+ accelerator : cmdOrAlt + "+Plus" ,
216+ click : ( ) => {
217+ if ( MainWindow == null ) {
218+ return ;
219+ }
220+ const zoomFactor = MainWindow . webContents . getZoomFactor ( ) ;
221+ MainWindow . webContents . setZoomFactor ( zoomFactor * 1.1 ) ;
222+ MainWindow . webContents . send ( "zoom-changed" ) ;
223+ } ,
224+ } ,
225+ {
226+ label : "Zoom Out" ,
227+ accelerator : cmdOrAlt + "+-" ,
228+ click : ( ) => {
229+ if ( MainWindow == null ) {
230+ return ;
231+ }
232+ const zoomFactor = MainWindow . webContents . getZoomFactor ( ) ;
233+ MainWindow . webContents . setZoomFactor ( zoomFactor / 1.1 ) ;
234+ MainWindow . webContents . send ( "zoom-changed" ) ;
235+ } ,
236+ } ,
204237 { type : "separator" } ,
205238 { role : "togglefullscreen" } ,
206239 ] ,
@@ -367,6 +400,9 @@ function createMainWindow(clientData) {
367400 win . on ( "close" , ( ) => {
368401 MainWindow = null ;
369402 } ) ;
403+ win . webContents . on ( "zoom-changed" , ( e ) => {
404+ win . webContents . send ( "zoom-changed" ) ;
405+ } ) ;
370406 win . webContents . setWindowOpenHandler ( ( { url, frameName } ) => {
371407 if ( url . startsWith ( "https://docs.waveterm.dev/" ) ) {
372408 console . log ( "openExternal docs" , url ) ;
0 commit comments