Commit 2d0af23 1 parent 74f7a55 commit 2d0af23 Copy full SHA for 2d0af23
File tree 2 files changed +12
-0
lines changed
2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import type { IpcController } from './ipc';
7
7
import { newIpcController } from './ipc' ;
8
8
import { createLogger } from './logger' ;
9
9
import { initializeMenu } from './menu' ;
10
+ import { PreferenceKey , Preferences } from './preference' ;
10
11
import type { Dispatcher } from './types' ;
11
12
12
13
app . setName ( 'Phoenix' ) ;
@@ -84,6 +85,9 @@ const createMainWindow = async (): Promise<void> => {
84
85
} ,
85
86
} ) ;
86
87
88
+ const zoomFactor = await Preferences . get ( PreferenceKey . WINDOW_ZOOM_FACTOR ) ;
89
+ mainWindow . webContents . setZoomFactor ( zoomFactor ?? 1 ) ;
90
+
87
91
// Once the window has finished loading, show it.
88
92
mainWindow . webContents . once ( 'did-finish-load' , ( ) => {
89
93
logger . debug ( 'showing main window' ) ;
Original file line number Diff line number Diff line change 1
1
import type { BrowserWindow , MenuItemConstructorOptions } from 'electron' ;
2
2
import { Menu , app , shell } from 'electron' ;
3
3
import { runInBackground } from '../../common/async' ;
4
+ import { PreferenceKey , Preferences } from '../preference' ;
4
5
5
6
/**
6
7
* Inspired by RedisInsight
@@ -34,6 +35,12 @@ function getMenuTemplate(
34
35
: buildDefaultTemplate ( window ) ;
35
36
}
36
37
38
+ const saveZoomFactorPreference = ( zoomFactor : number ) => {
39
+ runInBackground ( async ( ) => {
40
+ await Preferences . set ( PreferenceKey . WINDOW_ZOOM_FACTOR , zoomFactor ) ;
41
+ } ) ;
42
+ } ;
43
+
37
44
/**
38
45
* Gets the current zoom factor of the window.
39
46
* Returns a value between 0 < zoomFactor <= 1
@@ -48,6 +55,7 @@ function getZoomFactor(window: BrowserWindow): number {
48
55
*/
49
56
function setZoomFactor ( window : BrowserWindow , zoomFactor : number ) : void {
50
57
window . webContents . setZoomFactor ( zoomFactor ) ;
58
+ saveZoomFactorPreference ( zoomFactor ) ;
51
59
}
52
60
53
61
function resetZoomFactor ( window : BrowserWindow ) : void {
You can’t perform that action at this time.
0 commit comments