@@ -10,7 +10,6 @@ import {
10
10
LibraryService ,
11
11
SketchesService ,
12
12
} from '../common/protocol' ;
13
-
14
13
import {
15
14
MAIN_MENU_BAR ,
16
15
MenuContribution ,
@@ -51,6 +50,7 @@ import { SaveAsSketch } from './contributions/save-as-sketch';
51
50
import { ArduinoMenus } from './menu/arduino-menus' ;
52
51
import { MonitorViewContribution } from './serial/monitor/monitor-view-contribution' ;
53
52
import { ArduinoToolbar } from './toolbar/arduino-toolbar' ;
53
+ import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state' ;
54
54
55
55
const INIT_LIBS_AND_PACKAGES = 'initializedLibsAndPackages' ;
56
56
@@ -90,6 +90,9 @@ export class ArduinoFrontendContribution
90
90
@inject ( LocalStorageService )
91
91
private readonly localStorageService : LocalStorageService ;
92
92
93
+ @inject ( FrontendApplicationStateService )
94
+ private readonly appStateService : FrontendApplicationStateService ;
95
+
93
96
@postConstruct ( )
94
97
protected async init ( ) : Promise < void > {
95
98
const isFirstStartup = ! ( await this . localStorageService . getData (
@@ -137,17 +140,15 @@ export class ArduinoFrontendContribution
137
140
}
138
141
}
139
142
} ) ;
140
-
141
- // TODO: Verify this! If true IDE2 can start ~100ms faster.
142
- // If the preferences is resolved, then the `ready` call will happen in the same tick
143
- // and will do a `send_sync` request to the electron main to get the current window.
144
- // Consider moving after app `ready`.
145
- this . arduinoPreferences . ready . then ( ( ) => {
146
- const webContents = remote . getCurrentWebContents ( ) ;
147
- const zoomLevel = this . arduinoPreferences . get ( 'arduino.window.zoomLevel' ) ;
148
- webContents . setZoomLevel ( zoomLevel ) ;
149
- } ) ;
150
-
143
+ this . appStateService . reachedState ( 'initialized_layout' ) . then ( ( ) =>
144
+ this . arduinoPreferences . ready . then ( ( ) => {
145
+ const webContents = remote . getCurrentWebContents ( ) ;
146
+ const zoomLevel = this . arduinoPreferences . get (
147
+ 'arduino.window.zoomLevel'
148
+ ) ;
149
+ webContents . setZoomLevel ( zoomLevel ) ;
150
+ } )
151
+ ) ;
151
152
// Removes the _Settings_ (cog) icon from the left sidebar
152
153
app . shell . leftPanelHandler . removeBottomMenu ( 'settings-menu' ) ;
153
154
}
0 commit comments