Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
set zoom level after layout initialization.
Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
  • Loading branch information
Akos Kitta committed Jul 18, 2022
commit 8f93cf4352bf52d59c09db00ce7ad8c3b5b080af
25 changes: 13 additions & 12 deletions arduino-ide-extension/src/browser/arduino-frontend-contribution.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
} from '@theia/core/shared/inversify';
import * as React from '@theia/core/shared/react';
import { SketchesService } from '../common/protocol';

import {
MAIN_MENU_BAR,
MenuContribution,
Expand Down Expand Up @@ -46,6 +45,7 @@ import { SaveAsSketch } from './contributions/save-as-sketch';
import { ArduinoMenus } from './menu/arduino-menus';
import { MonitorViewContribution } from './serial/monitor/monitor-view-contribution';
import { ArduinoToolbar } from './toolbar/arduino-toolbar';
import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state';

export const SKIP_IDE_VERSION = 'skipIDEVersion';

Expand Down Expand Up @@ -76,6 +76,9 @@ export class ArduinoFrontendContribution
@inject(SketchesServiceClientImpl)
private readonly sketchServiceClient: SketchesServiceClientImpl;

@inject(FrontendApplicationStateService)
private readonly appStateService: FrontendApplicationStateService;

@postConstruct()
protected async init(): Promise<void> {
if (!window.navigator.onLine) {
Expand All @@ -102,17 +105,15 @@ export class ArduinoFrontendContribution
}
}
});

// TODO: Verify this! If true IDE2 can start ~100ms faster.
// If the preferences is resolved, then the `ready` call will happen in the same tick
// and will do a `send_sync` request to the electron main to get the current window.
// Consider moving after app `ready`.
this.arduinoPreferences.ready.then(() => {
const webContents = remote.getCurrentWebContents();
const zoomLevel = this.arduinoPreferences.get('arduino.window.zoomLevel');
webContents.setZoomLevel(zoomLevel);
});

this.appStateService.reachedState('initialized_layout').then(() =>
this.arduinoPreferences.ready.then(() => {
const webContents = remote.getCurrentWebContents();
const zoomLevel = this.arduinoPreferences.get(
'arduino.window.zoomLevel'
);
webContents.setZoomLevel(zoomLevel);
})
);
// Removes the _Settings_ (cog) icon from the left sidebar
app.shell.leftPanelHandler.removeBottomMenu('settings-menu');
}
Expand Down